PropertyInformationCollection
using System.Collections;
using System.Collections.Specialized;
namespace System.Configuration
{
public sealed class PropertyInformationCollection : NameObjectCollectionBase
{
public PropertyInformation this[string propertyName] {
get {
PropertyInformation propertyInformation = (PropertyInformation)BaseGet(propertyName);
if (propertyInformation == null) {
PropertyInformation propertyInformation2 = (PropertyInformation)BaseGet("");
if (propertyInformation2 != null && propertyInformation2.ProvidedName == propertyName)
propertyInformation = propertyInformation2;
}
return propertyInformation;
}
}
internal PropertyInformation this[int index] {
get {
return (PropertyInformation)BaseGet(BaseGetKey(index));
}
}
internal PropertyInformationCollection(ConfigurationElement thisElement)
: base(StringComparer.Ordinal)
{
foreach (ConfigurationProperty property in thisElement.Properties) {
if (property.Name != thisElement.ElementTagName)
BaseAdd(property.Name, new PropertyInformation(thisElement, property.Name));
}
base.IsReadOnly = true;
}
public void CopyTo(PropertyInformation[] array, int index)
{
if (array == null)
throw new ArgumentNullException("array");
if (array.Length < Count + index)
throw new ArgumentOutOfRangeException("index");
IEnumerator enumerator = GetEnumerator();
try {
while (enumerator.MoveNext()) {
PropertyInformation propertyInformation = (PropertyInformation)enumerator.Current;
array[index++] = propertyInformation;
}
} finally {
IDisposable disposable = enumerator as IDisposable;
if (disposable != null)
disposable.Dispose();
}
}
public override IEnumerator GetEnumerator()
{
int c = Count;
for (int i = 0; i < c; i++) {
yield return (object)this[i];
}
}
}
}