Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is Empty or Null
Message
 
 
To
19/03/2008 14:51:54
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 2.0
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01303548
Message ID:
01303554
Views:
13
>Would you not better use and AND instead of an OR ?
>
>>
>> if ((this.lsbUsers.SelectedItem != null &&  this.lsbUsers.Text != string.Empty)
>>            && this.LsbRoles.SelectedValue != null)
>
>I think the best thing to do is to always test for null first

I think you're right here, that when we need to test for negatives we need to use AND instead of OR.

I'll try that first and see, if it would resolve the problem.

If not, I appreciate future comments on the exact method in question.

UPDATE. Nope, no cigar.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform