如何在C#中将struct转换System.Byte byte[]为System.IO.Stream对象?
拳击是指将值类型分配给对象类型.将引用类型分配给对象时是否相同?
当分配一个类型(不是对象)时,会发生什么?那拳击呢?
int num=5;
object obj = num; //boxing
//////////////////////
MyClass my = new MyClass();
object obj = my; //what is name this convert (whethere is boxing?)
Run Code Online (Sandbox Code Playgroud) 我创建2个变量的名称与一个和b然后我初始化变量一个有值"开始",后来我给你变一个变量b,最后我改变变量的值,一到年底,但变量b不改变,而一个和b是参考类型!
string a = "start"; // Declare and initialize a variable
string b = a; // Copy the variable's value to a new variable
a = "end"; // Modify the value of the original variable
//variable b don't change!!
Run Code Online (Sandbox Code Playgroud)
为什么这不按预期工作?