コード例 #1
0
 public void CloneTest()
 {
     int[] anFirst  = new int[] { 1, 2, 4, 8 };
     int[] anSecond = ArrayUtility.Clone(anFirst);
     Assert.AreEqual(anFirst.Length, anSecond.Length);
     Assert.AreNotSame(anFirst, anSecond);
 }
コード例 #2
0
 public void ArrayUtility_Clone_1()
 {
     MyClass[] source = new MyClass[3];
     for (int i = 0; i < source.Length; i++)
     {
         source[i] = new MyClass {
             Value = i
         };
     }
     MyClass[] target = ArrayUtility.Clone(source);
     Assert.AreEqual(source.Length, target.Length);
     for (int i = 0; i < source.Length; i++)
     {
         Assert.AreEqual(source[i].Value, target[i].Value);
     }
 }