/// <summary> /// Initializes a new instance of the <see cref="Ticket"/> class. /// </summary> /// <param name="elements">The child elements.</param> public Ticket(params TicketChild[] elements) { var features = ImmutableNamedElementCollection.CreateFeatureCollectionBuilder(); var parameters = ImmutableNamedElementCollection.CreateParameterInitCollectionBuilder(); var properties = ImmutableNamedElementCollection.CreatePropertyCollectionBuilder(); foreach (var e in elements) { e.Apply( onFeature: x => features.Add(x), onParameterInit: x => parameters.Add(x), onProperty: x => properties.Add(x)); } _features = features.ToImmutable(); _parameters = parameters.ToImmutable(); _properties = properties.ToImmutable(); _declaredNamespaces = NamespaceDeclarationCollection.Default; }
/// <summary> /// Initializes a new instance of the <see cref="Feature"/> class. /// </summary> /// <param name="name">The name of the element.</param> /// <param name="elements">The options of the element.</param> public Feature(FeatureName name, params FeatureChild[] elements) { Name = name; var o = new Option(); var properties = ImmutableNamedElementCollection.CreatePropertyCollectionBuilder(); var options = ImmutableList.CreateBuilder <Option>(); var features = ImmutableNamedElementCollection.CreateFeatureCollectionBuilder(); foreach (var e in elements) { e.Apply( onProperty: x => properties.Add(x), onOption: x => options.Add(x), onFeature: x => features.Add(x)); } _properties = properties.ToImmutable(); _options = options.ToImmutable(); _features = features.ToImmutable(); }