CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2006
    Posts
    357

    Variable Suffixes

    Hey,

    Ive noticed on my travels that there seem to be alot of variable suffixes that ive never seen before...

    an example would be:

    Code:
    Object? var;
    Im not sure if Object is of type nullable... but it means that the var could be nullable i think... could be wrong though, ive never had need to use it.

    Anyway i was wondering:

    1) Is there a list of these suffixes somewhere online and what they do?
    2) Specifically what does Object^ var; do?

    Any advice would be great!

  2. #2
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: Variable Suffixes


    1) Is there a list of these suffixes somewhere online and what they do?
    2) Specifically what does Object^ var; do?
    1) - Just lookup (MSDN, google, etc) the specifications for C#2 (which introduced nullable types amongst other things) and C#3 (which introduced implicit local variables declarations amongst many other things)

    2) - That looks like C++/CLI syntax. Did you see that in C# code?

  3. #3
    Join Date
    Nov 2006
    Posts
    357

    Re: Variable Suffixes

    Quote Originally Posted by nelo View Post
    1) - Just lookup (MSDN, google, etc) the specifications for C#2 (which introduced nullable types amongst other things) and C#3 (which introduced implicit local variables declarations amongst many other things)

    2) - That looks like C++/CLI syntax. Did you see that in C# code?
    Im pretty sure it was in source code, ive not seen once single isntance of it, ive just seen these suffixes dotted around but have never been able to track down a single article about them...

  4. #4
    Join Date
    Mar 2004
    Location
    33°11'18.10"N 96°45'20.28"W
    Posts
    1,808

    Re: Variable Suffixes

    the ? after a variable type declares it nullable (for value types, but object is already nullable).

    the ^ suffix is a reference type and is used in C++ to differentiate between a managed pointer and a native pointer. http://www.codeproject.com/KB/books/...ionCh1Ex1.aspx
    Last edited by MadHatter; April 16th, 2009 at 07:24 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured