Mega Code Archive

 
Categories / VB.Net / Data Structure
 

Copies the ListDictionary to an array with DictionaryEntry elements

Imports System Imports System.Collections Imports System.Collections.Specialized Public Class SamplesListDictionary       Public Shared Sub Main()       Dim myCol As New ListDictionary()       myCol.Add("A", "a")       myCol.Add("B", "b")       myCol.Add("C", "c")       Dim myArr(myCol.Count) As DictionaryEntry       myCol.CopyTo(myArr, 0)       Dim i As Integer       For i = 0 To myArr.Length - 1          Console.WriteLine("   {0,-25} {1}", myArr(i).Key, myArr(i).Value)       Next i    End Sub 'Main End Class