C# == operator in Immediate window behaves differently than at run-time
- by Damiano
Try the following in the Immediate window:
object a1 = "a";
object a2 = "a";
a1==a2 // outputs false
and you'll see that a1 == a2 outputs false.
However, at runtime in either a window app or console, you'll get true:
object t1 = "a";
object t2 = "a";
MessageBox.Show((t1 == t2).ToString()); // outputs true
The runtime behavior is consistent with the definition for the == operator and strings.
Does anybody know if this a bug in the Immediate window?