Create a shallow copy of the Array in CSharp
Description
The following code shows how to create a shallow copy of the Array.
Example
/*w ww . ja v a 2 s .c o 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();
foreach(CultureInfo c in arrCIClone){
Console.WriteLine(c);
}
}
}
The code above generates the following result.