Skip to content

Instantly share code, notes, and snippets.

@threecourse
Created October 14, 2012 02:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save threecourse/c611e22c05cb412d8f94 to your computer and use it in GitHub Desktop.
Save threecourse/c611e22c05cb412d8f94 to your computer and use it in GitHub Desktop.
Topcoder - Array
class TPArray{
static public T[] CloneArray<T>(T[] array)
{
return (T[])array.Clone();
}
}
// needs TestUtilityClass
class TPArrayTest{
static public void test_CloneArray()
{
Console.WriteLine("Test_CloneArray");
int[] ary1 = new int[] { 1, 2, 3 };
int[] ary2 = TPArray.CloneArray<int>(ary1);
ary2[0] = 99;
TestUtility.eq_Assert(1, ary1, new int[] { 1, 2, 3 });
TestUtility.eq_Assert(1, ary2, new int[] { 99, 2, 3 });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment