1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using System;
- using System.Collections.Generic;
- namespace wf
- {
- public class ReadOnlySortedDictionary<Tkey, TVal>
- {
- public ReadOnlySortedDictionary(SortedDictionary<Tkey, TVal> srcData)
- {
- this.srcData = srcData;
- }
- public TVal this[Tkey key]
- {
- get
- {
- return this.Get(key);
- }
- }
- public int Count
- {
- get
- {
- return this.srcData.Count;
- }
- }
- public bool ContainsKey(Tkey key)
- {
- return this.srcData.ContainsKey(key);
- }
- public TVal Get(Tkey key)
- {
- return this.srcData[key];
- }
- public Tkey[] GetKeyArray()
- {
- Tkey[] array = new Tkey[this.srcData.Count];
- int num = 0;
- foreach (KeyValuePair<Tkey, TVal> keyValuePair in this.srcData)
- {
- array[num++] = keyValuePair.Key;
- }
- return array;
- }
- public TVal[] GetValueArray()
- {
- TVal[] array = new TVal[this.srcData.Count];
- int num = 0;
- foreach (KeyValuePair<Tkey, TVal> keyValuePair in this.srcData)
- {
- array[num++] = keyValuePair.Value;
- }
- return array;
- }
- public SortedDictionary<Tkey, TVal> Copy()
- {
- return new SortedDictionary<Tkey, TVal>(this.srcData);
- }
- private SortedDictionary<Tkey, TVal> srcData;
- }
- }
|