I have these statements and their' results are near them.
string a = "abc";
string b = "abc";
Console.Writeline(a == b); //true
object x = a;
object y = b;
Console.Writeline(x == y); // true
string c = new string(new char[] {'a','b','c'});
string d = new string(new char[] {'a','b','c'});
Console.Writeline(c == d); // true
object k = c;
object m = d;
Console.Writeline(k.Equals(m)) //true
Console.Writeline(k == m); // false
Why the last equality gives me false ?
The question is why ( x == y ) is true ( k == m ) is false
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…