C#中, Array copy 很方便於保存和復制數據.
常用的有兩個方法:
1. 復制源數組中的前N個數據到目標數組中
public static void Copy( Array sourceArray, Array destinationArray, int length )
2. 復制源數組中指定起始位置,指定長度的數據到目標數組中的某個指定起始位置中。
public static void Copy( Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length )
習題: 生成random數組,然后將他們拷貝到指定長度的數組中。
數組清零,用Array.Clear() 方法比較快.