Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is Empty or Null
Message
De
19/03/2008 15:09:54
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01303548
Message ID:
01303561
Vues:
15
This message has been marked as a message which has helped to the initial question of the thread.
>>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.
___

Ok, I was too quick to answer.

Why not set a breakpoint preceeded with
// if in vs2005 replace var by bool

var selnull = this.lsbUsers.SelectedItem != null;
var textempty = this.lsbUsers.Text != string.Empty;
var lsbrolesnull = is.LsbRoles.SelectedValue != null;

// put the break here
// examine the 3 variables

// your if( statement follows
if ((this ....
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform