/// <summary> /// Creates a collection with a single element as long /// as the name is not and empty string. /// </summary> public ConfigurationCollectionBoms() { ConfigurationElementBom bom = (ConfigurationElementBom)CreateNewElement(); if (!bom.Name.Equals("")) { Add(bom); } }
/// <summary> /// Creates collection of boms from an xml node. /// </summary> /// <param name="node">The XML node containing the collection of BOMS</param> public ConfigurationCollectionBoms(XmlNode node) { foreach (XmlAttribute attribute in node.Attributes) { if (Properties.Contains(attribute.Name)) { this[this.Properties[attribute.Name]] = this.Properties[attribute.Name].Converter.ConvertFrom(attribute.Value); } } foreach (XmlNode childNode in node.ChildNodes) { ConfigurationElementBom bom = (ConfigurationElementBom)Activator.CreateInstance(typeof(ConfigurationElementBom), childNode); if (bom.Name.Length != 0) { this.BaseAdd(bom); } } }
/// <summary> /// Adds an element to the collection /// </summary> /// <param name="field">The element you wish to add</param> public void Add(ConfigurationElementBom field) { BaseAdd(field); }
/// <summary> /// The index of the element provided. /// </summary> /// <param name="field">The element you wish to find the index of.</param> /// <returns>The index of the element.</returns> public int IndexOf(ConfigurationElementBom field) { return(BaseIndexOf(field)); }