Creates a shallow copy of the Array. : Array « Data Structure « VB.Net






Creates a shallow copy of the Array.

 

Imports System
Imports System.Globalization

Public Class SamplesArray
    Public Shared Sub Main()
        Dim ci0 As New CultureInfo("ar-SA", False)
        Dim ci1 As New CultureInfo("en-US", False)
        Dim ci2 As New CultureInfo("fr-FR", False)
        Dim ci3 As New CultureInfo("ja-JP", False)
        Dim arrCI() As CultureInfo = {ci0, ci1, ci2, ci3}

        Dim arrCIClone As CultureInfo() = CType(arrCI.Clone(), CultureInfo())

        Dim ci4 As New CultureInfo("th-TH", False)
        arrCIClone(0) = ci4

        PrintIndexAndValues(arrCI)
        PrintIndexAndValues(arrCIClone)
    End Sub 'Main

    Public Shared Sub PrintIndexAndValues(myArray As Array)
        Dim i As Integer
        For i = myArray.GetLowerBound(0) To myArray.GetUpperBound(0)
            Console.WriteLine(vbTab + "[{0}]:" + vbTab + "{1}", i, myArray.GetValue(i))
        Next i
    End Sub 

End Class 

   
  








Related examples in the same category

1.Create elements from one array to another array
2.Creates a one-dimensional Array of the specified Type and length, with zero-based indexing.
3.Creates a two-dimensional Array of the specified Type and dimension lengths, with zero-based indexing.
4.Creates a three-dimensional Array of the specified Type and dimension lengths, with zero-based indexing.
5.Creates a multidimensional Array of the specified Type and dimension lengths, with zero-based indexing.
6.Creates a multidimensional Array of the specified Type and dimension lengths, with the specified lower bounds.
7.Bounded array ExampleBounded array Example
8.For Each loops through ArrayFor Each loops through Array
9.Two ways to loop through ArrayTwo ways to loop through Array
10.A simple class to store in the array
11.Array UBoundArray UBound
12.Set Array Element Value by Index
13.Array IndexOf and LastIndexOfArray IndexOf and LastIndexOf
14.Use Array CreateInstance to Create ArrayUse Array CreateInstance to Create Array
15.Array Performance Test: One-dimensional arrayArray Performance Test: One-dimensional array
16.Free array's memory
17.Array Performance Test: SetValue(i, i)Array Performance Test: SetValue(i, i)
18.Declaring, allocating and initializing arraysDeclaring, allocating and initializing arrays
19.Use For Each/Next to find a minimum gradeUse For Each/Next to find a minimum grade
20.Reference an Element in an Array by IndexReference an Element in an Array by Index
21.Array Upper Bound and Lower BoundArray Upper Bound and Lower Bound
22.Init an Array in DeclarationInit an Array in Declaration
23.Array Length PropertyArray Length Property
24.Declare an Array and reference its memberDeclare an Array and reference its member
25.Store your won Class in an ArrayStore your won Class in an Array
26.Array Class provides methods for creating, manipulating, searching, and sorting arrays
27.Copies the last two elements from the Object array to the integer array
28.Creates and initializes a new three-dimensional Array of type Int32.
29.Sets a range of elements in the Array to zero, to false, or to Nothing, depending on the element type.
30.Converts an array of one type to an array of another type.
31.Copies a range of elements from an Array to another Array
32.Copies all the elements from one Array to another Array
33.Performs the specified action on each element of the specified array.
34.Returns an IEnumerator for the Array.
35.Reverses the sequence of the elements in the entire one-dimensional Array.
36.Array.GetLength
37.Gets the lower bound of the specified dimension in the Array.
38.Uses GetLowerBound and GetUpperBound in the for loop
39.Gets value at the specified position in the one-dimensional Array
40.Reverses the elements in a range