using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace SuperSocket.SocketBase.Config
{
///
/// Type provider colletion configuration
///
[ConfigurationCollection(typeof(TypeProvider))]
public class TypeProviderCollection : ConfigurationElementCollection, IEnumerable
{
///
/// When overridden in a derived class, creates a new .
///
///
/// A new .
///
protected override ConfigurationElement CreateNewElement()
{
return new TypeProvider() as ConfigurationElement;
}
///
/// 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)
{
var provider = element as TypeProvider;
if (provider == null)
return null;
return provider.Name;
}
///
/// Returns an enumerator that iterates through the collection.
///
///
/// A that can be used to iterate through the collection.
///
public new IEnumerator GetEnumerator()
{
int count = base.Count;
for (int i = 0; i < count; i++)
{
yield return (ITypeProvider)base.BaseGet(i);
}
}
}
}