Re: What is that question (?) sign after a type declaration?



On Jun 18, 6:06 pm, "....DotNet4Ever...." <hate.s...@xxxxxxxxxxx>
wrote:

I have been noticing declarations like this:

    private DateTime? _creationdate;

and have been wondering what is the function or meaning of that question
sign after the member type name. I searched the web but naturally with such
a thing in a query yields a lot of noise and no suitable results.

Can somebody enlighten me?

"T?" is syntactic sugar for writing "System.Nullable<T>". You can look
up the details on the latter in MSDN, but briefly, it is a type that
wraps any other value type, and adds null to its domain of values. So,
in your example, _creationdate can be either a DateTime, or null.
.



Relevant Pages