//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.Configuration { using System.Collections.Generic; using System.Configuration; /// /// Describes a collection of association type sub-elements in a .config file. /// internal class AssociationTypeCollection : ConfigurationElementCollection, IEnumerable { /// /// Initializes a new instance of the class. /// public AssociationTypeCollection() { } #region IEnumerable Members /// /// Returns an enumerator that iterates through the collection. /// /// /// A that can be used to iterate through the collection. /// public new IEnumerator GetEnumerator() { for (int i = 0; i < Count; i++) { yield return (AssociationTypeElement)BaseGet(i); } } #endregion /// /// When overridden in a derived class, creates a new . /// /// /// A new . /// protected override ConfigurationElement CreateNewElement() { return new AssociationTypeElement(); } /// /// 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 ((AssociationTypeElement)element).AssociationType ?? string.Empty; } } }