BecauseCodeYou need to assign a reference (variable address) of a value type variable to another variable in the code.
Int A = 1 , B = A;
B = 2 ;
In the above Code, the structure will be a = 1, B = 2; instead of a = 2, B = 2 as you expected; there are three methods in C:
One is the ref keyword.
This method only applies to parameter passing and is not suitable for value assignment statements.
The second is unsafe and insecure code.
This method can use & to represent the variable address like the C code. But it is not very flexible.
The three methods are packing. This is exactly what I want to talk about in this article. In fact, it is very simple, but I can't think of this method when I use it for a while. I thought about this method for a long time (Master Mo xiaoi ).
Int A = 1 , B = ( Int )( Object );
B = 2 ;< P>
/// result a = 2, B = 2;