using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace SuperWebSocket.Config
{
///
/// SubProtocol configuation collection
///
[ConfigurationCollection(typeof(SubProtocolConfig))]
public class SubProtocolConfigCollection : ConfigurationElementCollection
{
///
/// When overridden in a derived class, creates a new .
///
///
/// A new .
///
protected override ConfigurationElement CreateNewElement()
{
return new SubProtocolConfig();
}
///
/// 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 ((SubProtocolConfig)element).Name;
}
///
/// Gets the enumerator.
///
///
public new IEnumerator GetEnumerator()
{
int count = base.Count;
for (int i = 0; i < count; i++)
{
yield return (SubProtocolConfig)base.BaseGet(i);
}
}
///
/// Gets the type of the .
///
/// The of this collection.
public override ConfigurationElementCollectionType CollectionType
{
get
{
return ConfigurationElementCollectionType.BasicMap;
}
}
///
/// Gets the name used to identify this collection of elements in the configuration file when overridden in a derived class.
///
/// The name of the collection; otherwise, an empty string. The default is an empty string.
protected override string ElementName
{
get
{
return "protocol";
}
}
}
}