?
makes a value type (int
, bool
, DateTime
, or any other struct
or enum
) nullable via the System.Nullable
type. DateTime?
means that the variable is a System.Nullable
. You can assign a DateTime
or the value null
to that variable. To check if the variable has a value, use the HasValue
property and to get the actual value, use the Value
property.