0
|
1 using System;
|
|
2 using System.Configuration;
|
|
3
|
|
4 namespace BLToolkit.Configuration
|
|
5 {
|
|
6 internal abstract class ElementCollectionBase<T>: ConfigurationElementCollection
|
|
7 where T : ConfigurationElement, new()
|
|
8 {
|
|
9 protected override ConfigurationElement CreateNewElement()
|
|
10 {
|
|
11 return new T();
|
|
12 }
|
|
13
|
|
14 protected abstract object GetElementKey(T element);
|
|
15
|
|
16 protected override sealed object GetElementKey(ConfigurationElement element)
|
|
17 {
|
|
18 return GetElementKey((T)element);
|
|
19 }
|
|
20
|
|
21 public new T this[string name]
|
|
22 {
|
|
23 get { return (T)BaseGet(name); }
|
|
24 }
|
|
25
|
|
26 public T this[int index]
|
|
27 {
|
|
28 get { return (T)BaseGet(index); }
|
|
29 }
|
|
30 }
|
|
31 } |