I am inheriting some C#/Asp code from a programmer that believes in not comments at all. There are a few functions that have a parameter that is int? and I can't seem to find a reference to this anywhere as to what exactly this means. For example:
|
Can anyone tell me what exaclty placing the ? on the int type does?
Thanks,
Rod
Chris RileyPosted Aug 9, 2010, 10:02 AM
See http://msdn.microsoft.com/en-us/library/2cf62fcy.aspx
sham sumanPosted Aug 16, 2010, 6:46 AM
Here int? is means nullable type.
Nullable types are declared in one of two ways:
1. System.Nullable
-or-
2. T? variable
T is the underlying type of the nullable type.
The reason is int is a value type and null can't be assign into value type because it through exception.
kailash biswalPosted Aug 13, 2010, 4:46 AM
Generally we can not assign a null value to a value type, if u asign a null value it's throgh a execption , tto assign a null value to value type we are define ? operator
Rod PPosted Aug 9, 2010, 10:43 AM