No, if LockTime
hasn't been assigned a value, it will be the nullable value by default - so LockTime.Value
will throw an exception if you try to access it.
You can't assign null to LockTime.Value
itself, firstly because it's read-only and secondly because the type of LockTime.Value
is the non-nullable DateTime
type.
However, you can set the value of the variable to be the null value in several different ways:
LockTime = null; // Probably the most idiomatic way
LockTime = new DateTime?();
LockTime = default(DateTime?);