oops - so it does.
Heres some code to sort the contents of the dictionary based on its values,
having key and vlaues both of type string. See if you can work with that.
Dictionary<string, strings = new Dictionary<string, string>();
s.Add("1", "a Item");
s.Add("2", "c Item");
s.Add("3", "b Item");
List<KeyValuePair<string, string>myList = new
List<KeyValuePair<string, string>>(s);
myList.Sort(
delegate(KeyValuePair<string, stringfirstPair,
KeyValuePair<string, stringnextPair)
{
return firstPair.Value.CompareTo(nextPair.Value);
}
);
foreach (KeyValuePair<string, stringmyKey in myList)
{
Response.Write(myKey.Key + " " + myKey.Value);
}
--
Regards
John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com http://www.johntimney.com/blog
"Martin Pöpping" <ma******@despammed.comwrote in message
news:ej**********@newsreader2.netcologne.de...
John Timney (MVP) schrieb:
>have you looked at the generic SortedDictionary class
http://msdn2.microsoft.com/en-us/library/f7fta44c.aspx
Sure, but the SortedDictionary sorts by Key and I want to sort everything
by value