This seems like it should be really straight forward.
if I have:
object obj = *get value from somewhere*
if(obj == null){
MessageBox.Show("NULL");
}
Even when I debug and see that obj IS null, the code never goes into the if statement.
Do you have do do something different when comparing an object to null? (because an object can be any type?)
Okay, the comment’s giving it away:
That suggest it’s actually an array (or possibly another collection type) containing a single null reference, e.g.
The value of
objis not a null reference, hence it doesn’t go into the body of theifstatement.How you should handle this depends on what you’re trying to achieve. Do you really need
objto be statically typed as justobject?