S
Sergei Gnezdov
I've got code in NUnit which compares two strings.
Object str1 = ...
Object str2 = ...
Assertion.Assert(str1.Equals(str2)); // passes, str1 equals str2
Assertion.Assert(str1 == str2); // fails!
The following link states that str1 == str2 should compare values and
thus == operator should not return false in my case:
http://msdn.microsoft.com/library/d...ry/en-us/csref/html/vclrfequalityoperator.asp
More magic happens if I work from VisualStudio .NET 2003. If I stop
code execution in debugger for the code like this:
Boolean equals = str1 == str2
I will see that equals is false. If I execute str1 == str2 from
command window in immediate mode I will see true!
Can anybody explain to me what is going on.
Thank you
Object str1 = ...
Object str2 = ...
Assertion.Assert(str1.Equals(str2)); // passes, str1 equals str2
Assertion.Assert(str1 == str2); // fails!
The following link states that str1 == str2 should compare values and
thus == operator should not return false in my case:
http://msdn.microsoft.com/library/d...ry/en-us/csref/html/vclrfequalityoperator.asp
More magic happens if I work from VisualStudio .NET 2003. If I stop
code execution in debugger for the code like this:
Boolean equals = str1 == str2
I will see that equals is false. If I execute str1 == str2 from
command window in immediate mode I will see true!
Can anybody explain to me what is going on.
Thank you