Copy one 2D array to another 2D array

后端 未结 3 779
庸人自扰
庸人自扰 2020-12-09 16:44

I used this code to copy one 2D array to another 2D array:

Array.Copy(teamPerformance, 0,tempPerformance,0, teamPerformance.Length);

Howeve

3条回答
  •  醉酒成梦
    2020-12-09 17:37

    According to MS(http://msdn.microsoft.com/en-us/library/z50k9bft.aspx):

    If sourceArray and destinationArray are both reference-type arrays or are both arrays of type Object, a shallow copy is performed. A shallow copy of an Array is a new Array containing references to the same elements as the original Array. The elements themselves or anything referenced by the elements are not copied. In contrast, a deep copy of an Array copies the elements and everything directly or indirectly referenced by the elements.

提交回复
热议问题