What does one question mark following a variable declaration mean? [duplicate]

This is a nullable type. Nullable types allow value types (e.g. ints and structures like DateTime) to contain null.

The ? is syntactic sugar for Nullable<DateTime> since it’s used so often.

To call ToString():

if (timstamp.HasValue) {        // i.e. is not null
    return timestamp.Value.ToString();
}
else {
    return "<unknown>";   // Or do whatever else that makes sense in your context
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)