Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. int?

int?

Scheduled Pinned Locked Moved C#
csharphtmlhelpquestion
10 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vivekphlp
    wrote on last edited by
    #1

    When i was going thro the null types in C# i came across a statement which i had never met in my life ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_csref/html/e473cb01-28ca-42be-9cea-f717055d72c6.htm THe line is static void Main() { int? num = null; } What does the int? mean..

    Proud To Be an Indian

    D C V J 4 Replies Last reply
    0
    • V vivekphlp

      When i was going thro the null types in C# i came across a statement which i had never met in my life ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_csref/html/e473cb01-28ca-42be-9cea-f717055d72c6.htm THe line is static void Main() { int? num = null; } What does the int? mean..

      Proud To Be an Indian

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      Check this[^]

      Until you realize this message has nothing to say, its too late to stop reading

      1 Reply Last reply
      0
      • V vivekphlp

        When i was going thro the null types in C# i came across a statement which i had never met in my life ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_csref/html/e473cb01-28ca-42be-9cea-f717055d72c6.htm THe line is static void Main() { int? num = null; } What does the int? mean..

        Proud To Be an Indian

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        vivekphlp wrote:

        int? num = null;

        The value gives the clue. int? is a shortcut for INullable<int>, which is to say, a wrapper class that wraps an int, or null, which allows you to store null for an int value. You can put the ? after any value type as in double? or Decimal?

        Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        1 Reply Last reply
        0
        • V vivekphlp

          When i was going thro the null types in C# i came across a statement which i had never met in my life ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_csref/html/e473cb01-28ca-42be-9cea-f717055d72c6.htm THe line is static void Main() { int? num = null; } What does the int? mean..

          Proud To Be an Indian

          V Offline
          V Offline
          vivekphlp
          wrote on last edited by
          #4

          Thanks a lot. . .

          Proud To Be an Indian

          1 Reply Last reply
          0
          • V vivekphlp

            When i was going thro the null types in C# i came across a statement which i had never met in my life ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_csref/html/e473cb01-28ca-42be-9cea-f717055d72c6.htm THe line is static void Main() { int? num = null; } What does the int? mean..

            Proud To Be an Indian

            J Offline
            J Offline
            Jeeva Jose
            wrote on last edited by
            #5

            int? num = null; The meaning of the int? is represent the num is nothing there no mermory alocatin for the num the space of the num is empty.It is mainy used for DATA Base activity.

            Continue...

            C 1 Reply Last reply
            0
            • J Jeeva Jose

              int? num = null; The meaning of the int? is represent the num is nothing there no mermory alocatin for the num the space of the num is empty.It is mainy used for DATA Base activity.

              Continue...

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              This is not true at all. The memory is allocated, and the memory for the wrapper generic class that int? is a shortcut to, is also allocated. It's simply set up so that the initial value is null, which means that whatever value the int has ( an int cannot be null ), the wrapper class will not expose it, because it regards the value to be null intead.

              Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

              V 1 Reply Last reply
              0
              • C Christian Graus

                This is not true at all. The memory is allocated, and the memory for the wrapper generic class that int? is a shortcut to, is also allocated. It's simply set up so that the initial value is null, which means that whatever value the int has ( an int cannot be null ), the wrapper class will not expose it, because it regards the value to be null intead.

                Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                V Offline
                V Offline
                vivekphlp
                wrote on last edited by
                #7

                Christian Graus wrote:

                The memory is allocated, and the memory for the wrapper generic class that int? is a shortcut to, is also allocated

                SO you mean to say when we write int?num; // allocates 4 bytes of memory but requires an initial assignment. But "int?" is a "SHORTCUT to WHAT ???" is it System.Nullable<int> variable

                Proud To Be an Indian

                modified on Tuesday, April 8, 2008 4:32 AM

                C 1 Reply Last reply
                0
                • V vivekphlp

                  Christian Graus wrote:

                  The memory is allocated, and the memory for the wrapper generic class that int? is a shortcut to, is also allocated

                  SO you mean to say when we write int?num; // allocates 4 bytes of memory but requires an initial assignment. But "int?" is a "SHORTCUT to WHAT ???" is it System.Nullable<int> variable

                  Proud To Be an Indian

                  modified on Tuesday, April 8, 2008 4:32 AM

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  vivekphlp wrote:

                  But Graus "int?" is a "SHORTCUT to WHAT ???" is it System.Nullable variable

                  Yes. BTW, referring to people by their surname is considered rude in the West. Just saying....

                  Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                  V 1 Reply Last reply
                  0
                  • C Christian Graus

                    vivekphlp wrote:

                    But Graus "int?" is a "SHORTCUT to WHAT ???" is it System.Nullable variable

                    Yes. BTW, referring to people by their surname is considered rude in the West. Just saying....

                    Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                    V Offline
                    V Offline
                    vivekphlp
                    wrote on last edited by
                    #9

                    Sorry If i had hurted U. . . :((

                    Proud To Be an Indian

                    C 1 Reply Last reply
                    0
                    • V vivekphlp

                      Sorry If i had hurted U. . . :((

                      Proud To Be an Indian

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #10

                      Not at all, like I said I'm just saying. I understand that it's just a cultural difference between our countries, but, I thought it worth pointing out, because someone else might be offended.

                      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups