Reputation: 43833
The compiler is always complaining about: "Object reference not set to an instance of an object." So hopefully there is an easy way to check whether this is the case before I try doing something that would cause it... thanks.
Upvotes: 0
Views: 271
Reputation: 55082
Heh. Yes. Use
if(obj != null){
}
If it's a string, it's generally good to use:
if( !string.IsNullOrEmpty(foo) ){
}
Upvotes: 3