blob: 384497c50c71dddb6e9307c51879f26847bd1aa2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
//-----------------------------------------------------------------------
// <copyright file="AssociationTypeCollection.cs" company="Outercurve Foundation">
// Copyright (c) Outercurve Foundation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.Configuration {
using System.Collections.Generic;
using System.Configuration;
/// <summary>
/// Describes a collection of association type sub-elements in a .config file.
/// </summary>
internal class AssociationTypeCollection : ConfigurationElementCollection, IEnumerable<AssociationTypeElement> {
/// <summary>
/// Initializes a new instance of the <see cref="AssociationTypeCollection"/> class.
/// </summary>
public AssociationTypeCollection() {
}
#region IEnumerable<AssociationTypeElement> Members
/// <summary>
/// Returns an enumerator that iterates through the collection.
/// </summary>
/// <returns>
/// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
/// </returns>
public new IEnumerator<AssociationTypeElement> GetEnumerator() {
for (int i = 0; i < Count; i++) {
yield return (AssociationTypeElement)BaseGet(i);
}
}
#endregion
/// <summary>
/// When overridden in a derived class, creates a new <see cref="T:System.Configuration.ConfigurationElement"/>.
/// </summary>
/// <returns>
/// A new <see cref="T:System.Configuration.ConfigurationElement"/>.
/// </returns>
protected override ConfigurationElement CreateNewElement() {
return new AssociationTypeElement();
}
/// <summary>
/// Gets the element key for a specified configuration element when overridden in a derived class.
/// </summary>
/// <param name="element">The <see cref="T:System.Configuration.ConfigurationElement"/> to return the key for.</param>
/// <returns>
/// An <see cref="T:System.Object"/> that acts as the key for the specified <see cref="T:System.Configuration.ConfigurationElement"/>.
/// </returns>
protected override object GetElementKey(ConfigurationElement element) {
return ((AssociationTypeElement)element).AssociationType ?? string.Empty;
}
}
}
|