.Net 2.0 introduce "OrderedDictionary" in order to store sorted (key,object) pair value.
Here is the sample code in [C#]
using System.Collections.Specialized;
OrderedDictionary objOrderedDictionary = new OrderedDictionary();
objOrderedDictionary.Add("1", "first value");
objOrderedDictionary.Add("5", "second value");
objOrderedDictionary.Add("8", "third value");
objOrderedDictionary.Add("12", "fourth value");
//set enumerator
IDictionaryEnumerator enumerator;
enumerator = odServiceAmount.GetEnumerator();
while (enumerator.MoveNext())
{
string sKey = enumerator.Key.ToString().Trim();
string sValue = enumerator.Value.ToString().Trim();
}
Sunday, November 2, 2008
.Net- ordered Hashtable
Labels:
.Net,
C#,
Hashtable,
OrderedDictionary
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment