Use of IDictionary in Asp.net?

Posted by balajirnaukri-12656 under ASP.NET on 4/27/2012 | Points: 10 | Views : 1853 | Status : [Member] | Replies : 3
What is the use of IDictioary conept in Asp.net what is the exact usage of that?

Thanks and Regards
Balaji.R
ASP.NET Devloper
Solve-IT corp



Responses

Posted by: Sakthi.Singaravel on: 4/27/2012 [Member] Silver | Points: 25

Up
0
Down
The IDictionary class is used for storing collections of key-and-value pairs.

Each element is a key-and-value pair stored in a DictionaryEntry object.

Each association must have a unique key that is not a null reference

for example,

See student,
Key - reg no
Value - name

We can retrive it using key values..
These key values like primary kay in SQL..


Regards,
Singaravel M

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sf_Hussain786 on: 4/28/2012 [Member] Starter | Points: 25

Up
0
Down
Can anybody Send me any program related to IDictionary????

sf_hussain786

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/28/2012 [Member] Silver | Points: 25

Up
0
Down
VB .Net

Public Shared Sub Main() 


' Create a new dictionary of strings, with string keys,
' and access it through the IDictionary generic interface.
Dim openWith As IDictionary(Of String, String) = _
New Dictionary(Of String, String)

' Add some elements to the dictionary. There are no
' duplicate keys, but some of the values are duplicates.
openWith.Add("txt", "notepad.exe")
openWith.Add("bmp", "paint.exe")
openWith.Add("dib", "paint.exe")
openWith.Add("rtf", "wordpad.exe")

' The Add method throws an exception if the new key is
' already in the dictionary.
Try
openWith.Add("txt", "winword.exe")
Catch
Console.WriteLine("An element with Key = ""txt"" already exists.")
End Try

End Sub


Regards,
Singaravel M

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response