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