Jon Skeet [C# MVP] wrote:
Mark Sullivan <ms***@nortel.com> wrote:
When I trace through a csharp program I came to a situation where a
certain values has an "undefined value" as shown in the debugger
DbgClr.
I want to check this but the following statements did not recognize this "non"-value
if (type.Particle != Undefined.Value) { ....
or
if (type.Particle != null) { .....
In each of these code samples above the program went into the if
branch instead of skipping it.
Why?
The latter should be fine.
Could you post a short but complete program which demonstrates the
problem?
See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
I'm not sure if i'm understanding your problem right, but the debugger
will highlight something as undefined if your assigning it's value in an
if statement, but if you run a check like that i believe it will find
the value of it when it does parse through the if statements.