StringDictionary.ContainsKey Method determines if the StringDictionary contains a specific key.
Imports System
Imports System.Collections
Imports System.Collections.Specialized
Public Class SamplesStringDictionary
Public Shared Sub Main()
Dim myCol As New StringDictionary()
myCol.Add("red", "R")
myCol.Add("green", "G")
myCol.Add("blue", "B")
If myCol.ContainsKey("red") Then
Console.WriteLine("The collection contains the key ""red"".")
Else
Console.WriteLine("The collection does not contain the key ""red"".")
End If
End Sub 'Main
End Class
Related examples in the same category