Dictionary object - Csharp.Net

Q.  Which of the following is dictionary object?

- Published on 31 Aug 15

a. 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.

Hashtableht = new Hashtable();
ht["CompId"] = "1";
ht["CompName"] = "CareerRide";
foreach (DictionaryEntryob in ht)
Console.WriteLine(ob.Key+" : "+ob.Value);

Post your comment / Share knowledge

Enter the code shown above:
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)