This is a nullable type. Nullable types allow value types (e.g. int
s and structures like DateTime) to contain null.
The ?
is syntactic sugar for Nullable
since it's used so often.
To call ToString()
:
if (timstamp.HasValue) { // i.e. is not null
return timestamp.Value.ToString();
}
else {
return ""; // Or do whatever else that makes sense in your context
}