这是代码:
Employee e = new Employee() { Name = "Jeff", Age = 45 };
这是在生成调试程序集时编译它的方式:
Employee employee = new Employee();
employee.Name = "Jeff";
employee.Age = 45;
Employee employee2 = employee;
这就是构建版本时的编译方式:
Employee employee = new Employee();
employee.Name = "Jeff";
employee.Age = 45;
问题是:为什么调试生成会产生一个引用同一对象的变量?
翻阅古今
白板的微信
相关分类