Individual association types can now have configured lifetimes.
[dotnetoauth.git] / src / DotNetOpenAuth / Configuration / AssociationTypeCollection.cs
blob454168c70038616eb9ab79aae2229c1c71f34015
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;
9 using System.Collections.Generic;
10 using System.Configuration;
11 using System.Linq;
12 using System.Text;
14 /// <summary>
15 /// Describes a collection of association type sub-elements in a .config file.
16 /// </summary>
17 internal class AssociationTypeCollection : ConfigurationElementCollection, IEnumerable<AssociationTypeElement> {
18 /// <summary>
19 /// Initializes a new instance of the <see cref="AssociationTypeCollection"/> class.
20 /// </summary>
21 public AssociationTypeCollection() {
24 #region IEnumerable<AssociationTypeElement> Members
26 /// <summary>
27 /// Returns an enumerator that iterates through the collection.
28 /// </summary>
29 /// <returns>
30 /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
31 /// </returns>
32 public new IEnumerator<AssociationTypeElement> GetEnumerator() {
33 return this.Cast<AssociationTypeElement>().GetEnumerator();
36 #endregion
38 /// <summary>
39 /// When overridden in a derived class, creates a new <see cref="T:System.Configuration.ConfigurationElement"/>.
40 /// </summary>
41 /// <returns>
42 /// A new <see cref="T:System.Configuration.ConfigurationElement"/>.
43 /// </returns>
44 protected override ConfigurationElement CreateNewElement() {
45 return new AssociationTypeElement();
48 /// <summary>
49 /// Gets the element key for a specified configuration element when overridden in a derived class.
50 /// </summary>
51 /// <param name="element">The <see cref="T:System.Configuration.ConfigurationElement"/> to return the key for.</param>
52 /// <returns>
53 /// An <see cref="T:System.Object"/> that acts as the key for the specified <see cref="T:System.Configuration.ConfigurationElement"/>.
54 /// </returns>
55 protected override object GetElementKey(ConfigurationElement element) {
56 return ((AssociationTypeElement)element).AssociationType;