Re: A strange ? syntax

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

    Re: A strange ? syntax

    It's a C# shortcut for System.Nullable <Point>

  • Peter Duniho

    #2
    Re: A strange ? syntax

    On Thu, 21 Aug 2008 11:01:29 -0700, qualitychecker@ free.fr
    <qualitychecker @free.frwrote:
    On 21 août, 19:10, "Peter Morris" <mrpmorri...@SP AMgmail.comwrot e:
    >It's a C# shortcut for System.Nullable <Point>
    >
    Thanks for this quick answer. Where is this defined ? Not found in
    Microsoft docs "C Sharp language specification V1.2 nor V3.0" ?
    Is there other special notations like this ?
    I agree that because of the character being used, it can be difficult to
    find the answer using regular search engines. That is indeed
    unfortunate. However, it's not true that it's not found in the
    documentation or the specification. From the C# 3.0 specification (page
    5, "Introduction") :

    For each non-nullable value type T there
    is a corresponding nullable type T?, which
    can hold an additional value "null".

    And in 4.1.10 "Nullable Types":

    A nullable type is written T?, where T is the
    underlying type. This syntax is shorthand for
    System.Nullable <T>, and the two forms can be
    used interchangeably .

    Once you know what it is, it's simple enough to find the MSDN page in the
    C# programming guide where it's described. From
    http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx :

    The syntax T? is shorthand for Nullable(T),
    where T is a value type. The two forms are
    interchangeable .

    Hope that helps.

    Pete

    Comment

    Working...