My environment: VS .NET 2003 Version 7.1.3088
When I try to compare two objects which have same basic type like this:
//row is a DataRow object, both columns are integer type with same value
System.Debug.Write(row["title_id"] == row["book_title_id"]);
The C# actually runs and give a "False" result althghou these two column
have the same integer value. However, (very frustrating), the watch window
will show that "row["title_id"] == row["book_title_id"]" evaluates to true.
Is it a bug, or some sort of special design here?
Thanks,
Guogang
Carlos J. Quintero [MVP] - 25 Jun 2004 09:41 GMT
I have seen differences evaluating conditions between the compiled code and
the windows of the debugger, but I still don?t know why they happen.

Signature
Carlos J. Quintero (Visual Developer - .NET MVP)
FAQs, Knowledge Base, Files, Docs, Articles, Utilities, etc. for .NET
addins:
http://groups.yahoo.com/group/vsnetaddin/ (free join)
> My environment: VS .NET 2003 Version 7.1.3088
>
[quoted text clipped - 11 lines]
> Thanks,
> Guogang
Jason - 28 Jun 2004 12:43 GMT
its an object compairson - you need to unbox for equality testing of int
> My environment: VS .NET 2003 Version 7.1.3088
>
[quoted text clipped - 11 lines]
> Thanks,
> Guogang
Guogang - 29 Jun 2004 18:37 GMT
So, you believe the debug watch window showing "true" for the comparison is
correct behavior?
> its an object compairson - you need to unbox for equality testing of int
>
[quoted text clipped - 14 lines]
> > Thanks,
> > Guogang
Jason - 30 Jun 2004 12:29 GMT
depends what you are comparing
i would think that your c# code is more wrong. your c# code reads to me
object.ReferenceEquals(... - which given the 99.99999999999% liklihood that
you are probably intending on doing a data compairson - is wrong.
i have never considered the debug window to be quite the same as my running
c# code - i accept it as being a window into my running application - not an
object.ReferenceEquals window - but still - i take your point.
> So, you believe the debug watch window showing "true" for the comparison is
> correct behavior?
[quoted text clipped - 18 lines]
> > > Thanks,
> > > Guogang