${StandardHeader.C#} using System; using System.Configuration; namespace ${StandardNamespace} { /// /// A collection of ${ClassName}Element(s). /// public sealed class ${ClassName}Collection : ConfigurationElementCollection { #region Properties /// /// Gets the CollectionType of the ConfigurationElementCollection. /// public override ConfigurationElementCollectionType CollectionType { get { return ConfigurationElementCollectionType.BasicMap; } } /// /// Gets the Name of Elements of the collection. /// protected override string ElementName { get { return "${ClassName}"; } } /// /// Retrieve and item in the collection by index. /// public ${ClassName}Element this[int index] { get { return (${ClassName}Element)BaseGet(index); } set { if (BaseGet(index) != null) { BaseRemoveAt(index); } BaseAdd(index, value); } } #endregion /// /// Adds a ${ClassName}Element to the configuration file. /// /// The ${ClassName}Element to add. public void Add(${ClassName}Element element) { BaseAdd(element); } /// /// Creates a new ${ClassName}Element. /// /// A new ${ClassName}Element protected override ConfigurationElement CreateNewElement() { return new ${ClassName}Element(); } /// /// Gets the key of an element based on it's Id. /// /// Element to get the key of. /// The key of element. protected override object GetElementKey(ConfigurationElement element) { return ((${ClassName}Element)element).Name; } /// /// Removes a ${ClassName}Element with the given name. /// /// The name of the ${ClassName}Element to remove. public void Remove (string name) { base.BaseRemove(name); } } }