Exemplo n.º 1
0
        /// <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;
        }