SortedList.Add Method adds key and value to a SortedList object.
Imports System
Imports System.Collections
Imports Microsoft.VisualBasic
Public Class SamplesSortedList
Public Shared Sub Main()
Dim mySL As New SortedList()
mySL.Add("one", "The")
mySL.Add("two", "quick")
mySL.Add("three", "brown")
mySL.Add("four", "fox")
PrintKeysAndValues(mySL)
End Sub
Public Shared Sub PrintKeysAndValues(myList As SortedList)
Dim i As Integer
For i = 0 To myList.Count - 1
Console.WriteLine("{0}:{1}", myList.GetKey(i), myList.GetByIndex(i))
Next i
End Sub
End Class
Related examples in the same category