SortedList.Clear Method removes all elements from 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") mySL.Add("five", "jumped") mySL.Clear() Console.WriteLine("After Clear,") Console.WriteLine(" Count : {0}", mySL.Count) Console.WriteLine(" Capacity : {0}", mySL.Capacity) Console.WriteLine(" Values:") 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