盒装字符串相等

时间:2016-06-14 16:14:47

标签: c# string object boxing

有人请向我解释为什么拳击弦会导致false返回值吗?我不明白......

string a = string.Format("{0}{1}", "abc", "123");
string b = "abc123";
string c = "abc123";
Console.WriteLine(a == b);
Console.WriteLine((object)a == (object)b);
Console.WriteLine(c == b);
Console.WriteLine((object)c == (object)b);

0 个答案:

没有答案