Possible Duplicate:
What does the bool? return type mean?
I came a cross the following property in a class
public long? EmployeeId { get; set; }
I googled this operator with no luck, according to the MSDN MSDN OPERATOR there is only the operators ??
null-coalescing operator and ?:
conditional operator.
but what about ?
In this case ?
is not an operator. It is a shorter way to write: Nullable<long>
T?
is exactly the same as Nullable<T>
(with T
a type)
It is called a nullable type (see MSDN)
It is used to allow "non-nullable" type (like int
, long
, a struct
) to be assigned a null
value.
It is useful when you need a possible invalid state for a value type, or if the data is being retrieved from a database that may contain a null value.
This is not an operator. This is a shorthand for the Nullable type.
It's a nullable type. Look here:
http://msdn.microsoft.com/en-us/library/1t3y8s4s(v=vs.80).aspx
The syntax T? is shorthand for System.Nullable, where T is a value type. The two forms are interchangeable.
Source: Look here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With