End Google Ads 201810 - BS.net 01 -->
from Visudalstudio, Array.Clone reads: Creates a shallow copy of a array
but from the following simple test code, the results (a[0]=0 for two messagebox shows) show that Array.Clone is a deep copy (or else, the second output should be 100, because a and b refere to the same memory), how to understand it? thanks.
int [] a = new int [1];
a[0] = 0;
MessageBox.Show(a[0].ToString());
int[] b = new int[1];
b =(int []) a.Clone();
b[0] = 100;
MessageBox.Show(a[0].ToString());
مواقع النشر (المفضلة)