.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

What is dictionary in dotnet?

Posted By: Ramesh P     Posted Date: October 19, 2010    Points:2   Category :C#
Explain about dictionary

Author: laptop charles             
Posted Date: October 19, 2010     Points: 5   

Follow the link

Author: Asha.MP             
Posted Date: October 20, 2010     Points: 5   


Dictionaries map keys to values. For example, you might map an employee ID number to the object that represents the employee, or you might map a product ID to the object that represents the product. The .NET Framework includes the following dictionary classes:
1. Hashtable: A dictionary of name/value pairs that can be retrieved by name or index
2. SortedList: A dictionary that is sorted automatically by the key
3. StringDictionary: A hashtable with name/value pairs implemented as strongly typed strings
4.ListDictionary: A dictionary optimized for a small list of objects with fewer than 10 items
5. HybridDictionary: A dictionary that uses a ListDictionary for storage when the number of items is small and automatically switches to a Hashtable as the list grows
6. NameValueCollection: A dictionary of name/value pairs of strings that allows retrieval by name or index

Thanks and Regards,
Author: krishana singh             
Posted Date: October 23, 2010     Points: 5   

The Dictionary type in the base class library is one of the most important ones you need to use for your C# programs. It is an implementation of a hashtable, which is an extremely efficient way to store keys for lookup. The Dictionary in .NET is well-designed, and this section shows lots of ways you can use it.

Dictionary Examples, Keys and Values

--- Program that uses Dictionary [C#] ---

using System;
using System.Collections.Generic;

class Program
static void Main()
// Use the dictionary.
Dictionary<string, int> dict = new Dictionary<string, int>();
dict.Add("cat", 1);
dict.Add("dog", 4);


--- Output of the program ---


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend