Whilst playing around in an open source project, my attempt to ToString a DateTime object was thwarted by the compiler. When I jumped to the definition, I saw this:
public DateTime? timestamp;
Might someone please enlighten me on what this is called and why it might be useful?
This is a nullable type. Nullable types allow value types (e.g.
ints and structures like DateTime) to contain null.The
?is syntactic sugar forNullable<DateTime>since it’s used so often.To call
ToString():