Dictionary object - Csharp.Net
Q. Which of the following is dictionary object?
- Published on 31 Aug 15a. HashTable
b. SortedList
c. NameValueCollection
d. All of the above
ANSWER: All of the above
HashTable, SortedList, NameValueCollection are dictionary objects because it store data in key-value form.
Example:
Hashtableht = new Hashtable();
ht["CompId"] = "1";
ht["CompName"] = "CareerRide";
foreach (DictionaryEntryob in ht)
{
Console.WriteLine(ob.Key+" : "+ob.Value);
}