/// <summary> /// Initializes a new instance of the <see cref="Capabilities"/> class. /// </summary> /// <param name="elements">The child elements.</param> public Capabilities(params CapabilitiesChild[] elements) { var features = ImmutableNamedElementCollection.CreateFeatureCollectionBuilder(); var parameters = ImmutableNamedElementCollection.CreateParameterDefCollectionBuilder(); var properties = ImmutableNamedElementCollection.CreatePropertyCollectionBuilder(); foreach (var e in elements) { e.Apply( onFeature: x => features.Add(x), onParameterDef: x => parameters.Add(x), onProperty: x => properties.Add(x)); } _features = features.ToImmutable(); _parameters = parameters.ToImmutable(); _properties = properties.ToImmutable(); _declaredNamespaces = NamespaceDeclarationCollection.Default; }