المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Using sortedlist or sorteddictionary



C# Programming
05-28-2009, 10:41 PM
Hello,

I use SortedList as follows:
sortedlist sr=new sortedlist();
sr.add("abc","def");

How can i retrieve the value according the key? I mean if the key is "abc" and the value is "def"?
I mean when i write sr.getkey it can receive only integer , i mean sr.getkey(int) but i need string as key.

Also when i use :
sortedlist sr=net sortedlist();
sr.add("abc","def");
and i do :
string k=sr["abc"];
it says : The given key was not present in the dictionary

Also i tried SortedDictionary but it's the same with it