Tutorial by Examples

Each pair in the dictionary is an instance of KeyValuePair with the same type parameters as the Dictionary. When you loop through the dictionary with For Each, each iteration will give you one of the Key-Value Pairs stored in the dictionary. For Each kvp As KeyValuePair(Of String, String) In curren...
Dim extensions As New Dictionary(Of String, String) _ from { { "txt", "notepad" }, { "bmp", "paint" }, { "doc", "winword" } } This creates a dictionary and immediately fills it with three KeyValuePairs. You can also add new val...
You can get the value of an entry in the dictionary using the 'Item' property: Dim extensions As New Dictionary(Of String, String) From { { "txt", "notepad" }, { "bmp", "paint" }, { "doc", "winword" } } Dim program As St...
The ConstainsKey method is the way to know if a key already exists in the Dictionary. This come in handy for data reduction. In the sample below, each time we encountner a new word, we add it as a key in the dictionary, else we increment the counter for this specific word. Dim dic As IDictionary(...

Page 1 of 1