This example uses clone method to create a deep-copy of an array string, for array-list clone method please follow the link.(Note Hashtable clone is not a deep copy, Hastable short creates a deep copy).

using System;
using System.Collections;
//csc array_string_deepcopy.cs
namespace shallowcopy
{
public class simple
{
static int n1 = 0;
public string process(string[] s1)
{
//Console.WriteLine();
s1[3]="x";
foreach(string s in s1)
{
//if(s1[n1]="a"){ s1[n1]= "x";}
n1++;
Console.Write(s + " ");
}
return "good job";
}
}
class test
{
public static void Main()
{
string[ , ] a = new string[2, 2];
string[] b = {"a","b","c","d"};
string[] c = b; //simple copying is shallow copy
//both the arrays will refer to same address
Console.WriteLine("---Origninal b---");
foreach(string s in b){ Console.Write(s + " " );}
Console.WriteLine("\n---shallow copy from b to c---");
foreach(string s in c){ Console.Write(s + " " );}
Console.WriteLine();
Console.WriteLine("lenght of b = {0}",b.Length);
c[1] = "m"; b[3]="z";
Console.WriteLine("--note changes in b or c---");
foreach(string s in b){ Console.Write(s + " " );}
Console.WriteLine();
foreach(string s in c){ Console.Write(s + " " );}
Console.WriteLine();
//create an instace of the class
simple smp = new simple();
Console.WriteLine("--passing array to a routine-- 4th element of 0-3 will be altered--");
Console.WriteLine(smp.process(c));
Console.WriteLine("--changes in - 4th element affectd c[]--");
foreach(string s in c){ Console.Write(s + " " );}
Console.WriteLine();
//deep copy starts with Clone method
Console.WriteLine("---deep copy---");
string[]d =(string[])c.Clone();
d[2]="r";
Console.WriteLine("---string c results---");
foreach(string s in c){ Console.Write(s + " " );}
Console.WriteLine();
Console.WriteLine("---deep copy d results---");
foreach(string s in d){ Console.Write(s + " " );}
Console.WriteLine();
if( c.Equals(d)==false ){Console.WriteLine("---c and d differnet---");}
Console.ReadLine();
}
}
}