Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Null for a string
Message
De
07/05/2009 14:26:11
 
 
À
07/05/2009 14:02:56
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01398411
Message ID:
01398429
Vues:
45
BTW, just for reference, in C# the shorthand noation for a nullable type is the question mark (?), e.g.
int? myValue = (int?)null;
Bill
>
>Naomi, it depends if your variable type is a Value type or a Reference type. A value type (int, decimal, etc) cannot have null assigned to it, so your best bet is to use the Nullable generic and declare like:
>
>
>Nullable<int > myValue = null;
>
>
>A reference type (string, classes) are values in the stack that point to values on the heap. When you declare a reference type as null, you are essentially point it at nothing.
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform