TryGetValue can be a more efficient way to retrieve values
Imports System
Imports System.Collections.Generic
Public Class Example
Public Shared Sub Main()
Dim openWith As New SortedList(Of String, String)
openWith.Add("A", "a")
openWith.Add("B", "b")
openWith.Add("C", "c")
openWith.Add("D", "d")
Dim value As String = ""
If openWith.TryGetValue("tif", value) Then
Console.WriteLine("For key = ""tif"", value = {0}.", value)
Else
Console.WriteLine("Key = ""tif"" is not found.")
End If
End Sub
End Class
Related examples in the same category