C# Value and Reference types

前端 未结 6 1260
灰色年华
灰色年华 2021-01-06 15:55

Please see the following lines of code mentioned below:

byte[] a = { 1, 2, 3, 4 };
byte[] b = a; // b will have all values of a.
a = null; 

6条回答
  •  不要未来只要你来
    2021-01-06 16:17

    You are making b point to the memory address that contains the byte array. Then afterwards, you are making a point to null. b remains unchanged.

提交回复
热议问题