Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why a string comes back as null
Message
De
03/12/2008 03:54:27
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Application:
Desktop
Divers
Thread ID:
01365266
Message ID:
01365323
Vues:
9
>
>Look closer to my suggestion. You need to re-assign this filename variable again inside the loop. I think it's clearer than assignment and comparision as you're currently trying. At least for me it's simpler to understand and maintain.

Nadya,

This is the way assignment works in C/C# - you'll find a lot of those constructs (I wish Foxpro had them)
The assignment operators (=, /=, +=, *=, ...) have (except for the => operator) the lowest precedence
Also, the assignment operators (together with the unary operator and conditional operator) are right associative

have a look at this: http://msdn.microsoft.com/en-us/library/aa691323(VS.71).aspx

hence,
		int i, j, k;
		i = j = k = 1;
also
int x = 0;
int y = -~x; //1
int z = ~-x; // -1
so, the parentheses are needed around (filename = PopQueue()) to force the assignment to be executed first
while ( (filename = PopQueue()) != "" )
{
}
without parentheses, it would be executed like this (and filename would have to be a bool)
while ( filename = (PopQueue() != "") )
{
}
Once you start using it, you'll love it
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform