1
//-----------------------------------------------------------------------
2 // <copyright file="AssociationTypeCollection.cs" company="Andrew Arnott">
3 // Copyright (c) Andrew Arnott. All rights reserved.
5 //-----------------------------------------------------------------------
7 namespace DotNetOpenAuth
.Configuration
{
8 using System
.Collections
.Generic
;
9 using System
.Configuration
;
12 /// Describes a collection of association type sub-elements in a .config file.
14 internal class AssociationTypeCollection
: ConfigurationElementCollection
, IEnumerable
<AssociationTypeElement
> {
16 /// Initializes a new instance of the <see cref="AssociationTypeCollection"/> class.
18 public AssociationTypeCollection() {
21 #region IEnumerable<AssociationTypeElement> Members
24 /// Returns an enumerator that iterates through the collection.
27 /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
29 public new IEnumerator
<AssociationTypeElement
> GetEnumerator() {
30 for (int i
= 0; i
< Count
; i
++) {
31 yield return (AssociationTypeElement
)BaseGet(i
);
38 /// When overridden in a derived class, creates a new <see cref="T:System.Configuration.ConfigurationElement"/>.
41 /// A new <see cref="T:System.Configuration.ConfigurationElement"/>.
43 protected override ConfigurationElement
CreateNewElement() {
44 return new AssociationTypeElement();
48 /// Gets the element key for a specified configuration element when overridden in a derived class.
50 /// <param name="element">The <see cref="T:System.Configuration.ConfigurationElement"/> to return the key for.</param>
52 /// An <see cref="T:System.Object"/> that acts as the key for the specified <see cref="T:System.Configuration.ConfigurationElement"/>.
54 protected override object GetElementKey(ConfigurationElement element
) {
55 return ((AssociationTypeElement
)element
).AssociationType
;