using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Configuration; namespace SuperWebSocket.Config { /// /// Command configuration collection /// [ConfigurationCollection(typeof(CommandConfig))] public class CommandConfigCollection : ConfigurationElementCollection { /// /// Gets or sets a property, attribute, or child element of this configuration element. /// /// The specified property, attribute, or child element public CommandConfig this[int index] { get { return (CommandConfig)base.BaseGet(index); } set { if (base.BaseGet(index) != null) { base.BaseRemoveAt(index); } this.BaseAdd(index, value); } } /// /// When overridden in a derived class, creates a new . /// /// /// A new . /// protected override ConfigurationElement CreateNewElement() { return new CommandConfig(); } /// /// Gets the element key for a specified configuration element when overridden in a derived class. /// /// The to return the key for. /// /// An that acts as the key for the specified . /// protected override object GetElementKey(ConfigurationElement element) { return element.GetHashCode(); } /// /// Gets the enumerator. /// /// public new IEnumerator GetEnumerator() { int count = base.Count; for (int i = 0; i < count; i++) { yield return (CommandConfig)base.BaseGet(i); } } } }