List(T).CopyTo Method copies a range of elements from the List(Of T) to one-dimensional array : List « Data Structure « VB.Net

List(T).CopyTo Method copies a range of elements from the List(Of T) to one-dimensional array


Imports System
Imports System.Collections.Generic

Public Class Example

    Public Shared Sub Main()

        Dim numbers As New List(Of String)


        For Each num As String In numbers

        Dim array(14) As String

        numbers.CopyTo(array, 6)
        numbers.CopyTo(2, array, 12, 3)

        Console.WriteLine(vbLf & "Contents of the array:")
        For Each num As String In array

    End Sub
End Class


Related examples in the same category

1.List Range operation
2.Check the List.Capacity before and after adding elements
3.Does List contain a certain element
4.Add element to List at position of 2
5.Remove an element from List
6.Trim down extra capacity from List
7.Clear a List
8.Using a BindingSource component to bind a list to a DataGridView control
9.Uses a cursor to step through the message queues and list the public queues on the network.
10.Using Order By to sort a list of words alphabetically
11.Using Order By to sort a list of words by length
12.Using Group By to partition a list of words by first letter
13.Converting ToList
14.Using a Where clause to find all projectList that are in stock and cost more than 3.00 per unit
15.Using Take to get the first 3 orders from employeeList
16.Using Payment By to sort a list of projectList by units in stock from highest to lowest
17.Using Except to do minus between two lists
18.Use Action<(Of <(T>)>) delegate to print the contents of a List<(Of <(T>)>) object.
19.List the Unicode code point of each of the control characters.
20.Create a SortedList using the default comparer.
21.Create a SortedList using the specified case-insensitive comparer.
22.Create a SortedList using the specified CaseInsensitiveComparer,
23.Create a SortedList using the StringComparer.InvariantCultureIgnoreCase value.
24.Implements a TextWriterTraceListener named myWriter to write to the console screen.
25.All three overloads of the CopyTo method in List<(Of <(T>)>)
26.Create a fixed-size wrapper around an ArrayList.
27.Synchronize an ArrayList, determine if an ArrayList is synchronized and use a synchronized ArrayList.
28.LinkedListNode<(Of <(T>)>), adds it to a LinkedList<(Of <(T>)>), tracks values of its properties as the LinkedList<(Of <(T>)>) changes.
29.What is the different between the Count and Capacity
30.Get the fourth element
31.List(T) Class is a strongly typed list of objects that can be accessed by index
32.Add strings to List of String and use For Each loop to show each item
33.Insert in the middle of a List
34.Remove an element from List
35.Trim a List
36.Clear a List
37.Convert element in List to string
38.List Linq operator: Any
39.List Linq operator: First
40.List Linq operator: Where
41.Create List(Of T) class that contains elements copied from the specified collection
42.Add another list to the current list
43.Get range from a List
44.Create List(Of T) class that is empty and has the specified initial capacity.
45.List(T).BinarySearch Method searches sorted List(Of T) using the default comparer
46.List(T).ConvertAll(TOutput) Method converts List(Of T) to another type
47.List(T).ForEach Method Performs the specified action on each element of the List(Of T).
48.List(T).IndexOf Method searches for object and returns the zero-based index
49.List(T).LastIndexOf Method searches for the specified object and returns the zero-based index of the last occurrence
50.List(T).Reverse Method reverses the order of the elements in the specified range.
51.Add after a LinkedListNode
52.Create LinkedList(Of T) class that is empty.
53.LinkedListNode(T) Class represents a node in a LinkedList(Of T).
54.Copies the ListDictionary to an array with DictionaryEntry elements
55.ListDictionary.Add Method adds an entry with the specified key and value into the ListDictionary.
56.ListDictionary.Contains Method tells whether the ListDictionary contains a specific key.
57.ListDictionary.CopyTo Method copies the ListDictionary entries to a one-dimensional Array
58.LinkedListNode(T) Class represents a node in a LinkedList(Of T). This class cannot be inherited.
59.Check the Capacity and Count
60.Check the existance of an item with Contains method
61.Get the item by index
62.Remove a range
63.Insert range