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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ....DotNet4Ever....

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

    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?

    Cheers,
    Emilio

  • Pavel Minaev

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

    On Jun 18, 6:06 pm, "....DotNet4Eve r...." <hate.s...@nowh ere.com>
    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.Nullabl e<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.

    Comment

    Working...