C# Array Clone
Description
Array Clone
creates a shallow copy of the Array.
Syntax
Array.Clone
has the following syntax.
public Object Clone()
Returns
Array.Clone
method returns A shallow copy of the Array.
Example
The following code example clones a System.Globalization.CultureInfo array and demonstrates the behavior of a shallow copy.
/* www .j a va 2 s . co m*/
using System;
using System.Globalization;
public class SamplesArray {
public static void Main() {
CultureInfo[] arrCI = new CultureInfo[] { new CultureInfo( "ar-SA", false ),
new CultureInfo( "en-US", false ) };
// Create a clone of the CultureInfo array.
CultureInfo[] arrCIClone = (CultureInfo[]) arrCI.Clone();
}
}
The code above generates the following result.