SortedList.CopyTo Method copies SortedList to a one-dimensional Array
Imports System
Imports System.Collections
Public Class SamplesSortedList
Public Shared Sub Main()
Dim mySourceList As New SortedList()
mySourceList.Add(2, "2")
mySourceList.Add(3, "3")
mySourceList.Add(1, "1")
Dim myTargetArray(14) As DictionaryEntry
mySourceList.CopyTo(myTargetArray, 6)
PrintValues(myTargetArray, " "c)
End Sub
Public Shared Sub PrintValues(myArr() As DictionaryEntry, mySeparator As Char)
Dim i As Integer
For i = 0 To myArr.Length - 1
Console.Write("{0}{1}", mySeparator, myArr(i).Value)
Next i
End Sub
End Class
Related examples in the same category