Imports System.Collections
public class Test
public Shared Sub Main
Dim jobs As New SortedList
jobs.Add("02", "Two")
jobs.Add("10", "Ten")
jobs.Add("01", "One")
jobs.Add("06", "Six")
For i As Integer = 0 To jobs.Count - 1
Console.WriteLine(jobs.GetKey(i).ToString() & ": " & _
jobs.GetByIndex(i).ToString())
Next i
jobs.Clear()
jobs.Add(2, "Two")
jobs.Add(10, "Ten")
jobs.Add(1, "One")
jobs.Add(6, "Six")
For i As Integer = 0 To jobs.Count - 1
Console.WriteLine(jobs.GetKey(i).ToString() & ": " & _
jobs.GetByIndex(i).ToString())
Next i
End Sub
End class
|