VB.Net by API/System.Collections/ICollection

Материал из VB Эксперт
Перейти к: навигация, поиск

ICollection.CopyTo

   
 
Option Strict On
Imports System.Collections
Public Module modMain
   Public Sub Main()
      Dim airports As New Hashtable
      airports.Add("S", "SSS")
      airports.Add("X", "XXX")
      airports.Add("D", "DDD")
      airports.Add("R", "RRR")
      
      Dim keys As ICollection = airports.Keys
      Dim keysArray(airports.Count - 1) As String
      keys.CopyTo(keysArray, 0)
      Array.Sort(keysArray)
      For Each key As String in KeysArray
         Console.WriteLine("{0} is {1}", key, airports(key))
      Next
   End Sub
End Module