Hashtable.CopyTo Method copies the Hashtable elements to a one-dimensional Array instance at the specified index. : HashTable « Data Structure « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » Data Structure » HashTableScreenshots 
Hashtable.CopyTo Method copies the Hashtable elements to a one-dimensional Array instance at the specified index.
 

Imports System
Imports System.Collections

Public Class SamplesHashtable
    Public Shared Sub Main()
        Dim mySourceHT As New Hashtable()
        mySourceHT.Add("A""valueA")
        mySourceHT.Add("B""valueB")

        Dim myTargetArray(14As String
        myTargetArray(0"The"
        myTargetArray(1"quick"
        myTargetArray(2"brown"
        myTargetArray(3"fox"

        PrintValues(myTargetArray)

        mySourceHT.Keys.CopyTo(myTargetArray, 6)

        PrintValues(myTargetArray)

        mySourceHT.Values.CopyTo(myTargetArray, 6)

        PrintValues(myTargetArray)

    End Sub 'Main

    Public Shared Sub PrintValues(myArr() As String)
        Dim As Integer
        For i = To myArr.Length - 1
            Console.WriteLine("{0}", myArr(i))
        Next i
    End Sub
End Class

   
  
Related examples in the same category
1.Hashtable: add,get,count, Dictionary Key and value EnumeratorHashtable: add,get,count, Dictionary Key and value Enumerator
2.Store Environment Variables into a Hash tableStore Environment Variables into a Hash table
3.Create a Hashtable using the default hash code provider and the default comparer.
4.Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer
5.Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer
6.Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer based on the Turkish culture (tr-TR)
7.Create Hashtable class from another dictionary
8.Hashtable.Add Method adds an element with the specified key and value into the Hashtable.
9.Hashtable.Clear Method removes all elements from the Hashtable.
10.Hashtable.Contains Method Determines whether the Hashtable contains a specific key.
11.Hashtable.GetEnumerator Method returns an IDictionaryEnumerator that iterates through the Hashtable.
12.Displays the keys and values of the Hashtable using foreach statement
13.Hashtable.IsSynchronized Property gets a value indicating whether access to the Hashtable is synchronized (thread safe).
14.Hashtable.Remove Method removes the element with the specified key from the Hashtable.
www_.j__av___a__2_s__.__c___o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.