string a ="Hello world";string b =string.Intern(a);
Debug.Log(string.Format("a is b ? {0}",ReferenceEquals(a, b)));// truestring c =string.Copy(a);
Debug.Log(string.Format("c is a ? {0}",ReferenceEquals(c, a)));// false
System.Diagnostics.DebuggerNonUserCode
对该函数不能单步调试(F10),即使可以打断点,但一定执行下一步,必然直接跳出函数到执行结束的步骤
DebuggerNonUserCodeAttribute 是针对属性的
[global::System.Diagnostics.DebuggerNonUserCode]voidTestStringIntern(){string a ="Hello world";string b =string.Intern(a);
Debug.Log(string.Format("a is b ? {0}",ReferenceEquals(a, b)));// truestring c =string.Copy(a);
Debug.Log(string.Format("c is a ? {0}",ReferenceEquals(c, a)));// falseint k =this.test_value;int abc =232;
k += abc;}int m_test_value =0;[global::System.Diagnostics.DebuggerNonUserCodeAttribute]publicint test_value {get{return m_test_value;}set{
m_test_value =value;}}