-
-
Save threecourse/c611e22c05cb412d8f94 to your computer and use it in GitHub Desktop.
Topcoder - Array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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