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. The Lounge
  3. Nullable types??

Nullable types??

Scheduled Pinned Locked Moved The Lounge
questiondiscussion
40 Posts 22 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.
  • H hairy_hats

    When there's an R in the month.

    I hope you realise that hamsters are very creative when it comes to revenge. - Elaine

    I Offline
    I Offline
    Ian Shlasko
    wrote on last edited by
    #14

    bool areNullablesGood = ("the month".indexOf('R') >= 0); Well, that answers that.

    Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)

    J L 2 Replies Last reply
    0
    • J Jim Crafton

      I'd reply, but I'm in the middle of an access violation...

      ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

      D Offline
      D Offline
      Douglas Troy
      wrote on last edited by
      #15

      Jim Crafton wrote:

      but I'm in the middle of an access violation...

      Don't want to know. Don't want to know. Don't want to know. :-D


      :..::. Douglas H. Troy ::..
      Bad Astronomy |VCF|wxWidgets|WTL

      J 1 Reply Last reply
      0
      • I Ian Shlasko

        bool areNullablesGood = ("the month".indexOf('R') >= 0); Well, that answers that.

        Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)

        J Offline
        J Offline
        JacquesDP
        wrote on last edited by
        #16

        but he did not specify whether having the R is good or not ;P

        No matter how long he who laughs last laughs, he who laughs first has a head start!

        H 1 Reply Last reply
        0
        • D Douglas Troy

          Jim Crafton wrote:

          but I'm in the middle of an access violation...

          Don't want to know. Don't want to know. Don't want to know. :-D


          :..::. Douglas H. Troy ::..
          Bad Astronomy |VCF|wxWidgets|WTL

          J Offline
          J Offline
          Jim Crafton
          wrote on last edited by
          #17

          Sounds like you're suffering from a stack overflow?

          ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

          D 1 Reply Last reply
          0
          • J JacquesDP

            but he did not specify whether having the R is good or not ;P

            No matter how long he who laughs last laughs, he who laughs first has a head start!

            H Offline
            H Offline
            hairy_hats
            wrote on last edited by
            #18

            You noticed. :laugh:

            I hope you realise that hamsters are very creative when it comes to revenge. - Elaine

            1 Reply Last reply
            0
            • B Bardy85

              Well then. When are they good and when are they bad? Is that better?

              D Offline
              D Offline
              Dario Solera
              wrote on last edited by
              #19

              They are good when you need a nullable type. Or, when you need compatibility with other platforms (while designing web services contracts, for example).

              If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki

              1 Reply Last reply
              0
              • B Bardy85

                Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #20

                Bardy85 wrote:

                Are they good or are they bad?

                Neither. You use the correct tool for the job. Nullable types are just another tool in the toolbox. They serve a specific surpose. I don't qualify them as "good" or "bad".

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008
                But no longer in 2009...

                B realJSOPR 2 Replies Last reply
                0
                • J Jim Crafton

                  Sounds like you're suffering from a stack overflow?

                  ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

                  D Offline
                  D Offline
                  Douglas Troy
                  wrote on last edited by
                  #21

                  Jim Crafton wrote:

                  Sounds like you're suffering from a stack overflow?

                  Sounds like a medical condition that afflicts older developers. [cue drug company commercial here] Do you suffer from Stack Overflow? Is this affecting your love life? Work? Family? Friends? Millions of aging Software Developers, like you, live with SOF everyday. Well, worry no more. With Stacagra, you'll regain your confidence and management over your Stack once again. :rolleyes:


                  :..::. Douglas H. Troy ::..
                  Bad Astronomy |VCF|wxWidgets|WTL

                  modified on Monday, August 3, 2009 11:54 AM

                  P 1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    Bardy85 wrote:

                    Are they good or are they bad?

                    Neither. You use the correct tool for the job. Nullable types are just another tool in the toolbox. They serve a specific surpose. I don't qualify them as "good" or "bad".

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007, 2008
                    But no longer in 2009...

                    B Offline
                    B Offline
                    Bardy85
                    wrote on last edited by
                    #22

                    True. What ever is best for the job. Simple. easy. For some reason when I code, I sit for hours wasting time, trying to find the best way foward. I know there are always a handfull of ways to accomplish a given task. I'm just trying to find the "best",most effecient,simplest solution. Maybe that it. Time. Every ms counts. Oh well. Think it's just monday driving me up the wall. Thanks anyway.

                    D 1 Reply Last reply
                    0
                    • J Jim Crafton

                      I'd reply, but I'm in the middle of an access violation...

                      ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

                      J Offline
                      J Offline
                      Joan M
                      wrote on last edited by
                      #23

                      Are you violating MS Access? :rolleyes:

                      [www.tamelectromecanica.com][www.tam.cat]

                      D 1 Reply Last reply
                      0
                      • B Bardy85

                        Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

                        J Offline
                        J Offline
                        Joan M
                        wrote on last edited by
                        #24

                        Once I met one that was really, really bad... :rolleyes:

                        [www.tamelectromecanica.com][www.tam.cat]

                        1 Reply Last reply
                        0
                        • I Ian Shlasko

                          bool areNullablesGood = ("the month".indexOf('R') >= 0); Well, that answers that.

                          Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)

                          L Offline
                          L Offline
                          Luc Pattyn
                          wrote on last edited by
                          #25

                          Ian Shlasko wrote:

                          bool areNullablesGood = ("the month".indexOf('R') >= 0);

                          That seems pretty close to the truth, as (1) months have at most one capital letter (never an R), (2) and "the month" has none. :)

                          Luc Pattyn [Forum Guidelines] [My Articles]


                          The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


                          1 Reply Last reply
                          0
                          • J Joan M

                            Are you violating MS Access? :rolleyes:

                            [www.tamelectromecanica.com][www.tam.cat]

                            D Offline
                            D Offline
                            Dan Neely
                            wrote on last edited by
                            #26

                            MS access users are violated.

                            The European Way of War: Blow your own continent up. The American Way of War: Go over and help them.

                            G 1 Reply Last reply
                            0
                            • B Bardy85

                              True. What ever is best for the job. Simple. easy. For some reason when I code, I sit for hours wasting time, trying to find the best way foward. I know there are always a handfull of ways to accomplish a given task. I'm just trying to find the "best",most effecient,simplest solution. Maybe that it. Time. Every ms counts. Oh well. Think it's just monday driving me up the wall. Thanks anyway.

                              D Offline
                              D Offline
                              Dan Neely
                              wrote on last edited by
                              #27

                              Don't use them when you don't have to. Every time you call an API expecting a non nullable value you'll have to do validation/conversion of your nullables.

                              The European Way of War: Blow your own continent up. The American Way of War: Go over and help them.

                              1 Reply Last reply
                              0
                              • B Bardy85

                                Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

                                S Offline
                                S Offline
                                Shog9 0
                                wrote on last edited by
                                #28

                                Bad. But inconsistency is worse. Rather all types be nullable than just a subset...

                                D 1 Reply Last reply
                                0
                                • B Bardy85

                                  Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

                                  M Offline
                                  M Offline
                                  Marc Clifton
                                  wrote on last edited by
                                  #29

                                  Useless, because there's no mapping of a nullable type to an object with value DBNull.Value. Marc

                                  Will work for food. Interacx

                                  I'm not overthinking the problem, I just felt like I needed a small, unimportant, uninteresting rant! - Martin Hart Turner

                                  1 Reply Last reply
                                  0
                                  • B Bardy85

                                    Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

                                    J Offline
                                    J Offline
                                    Judah Gabriel Himango
                                    wrote on last edited by
                                    #30

                                    Given that the inventor of null calls it his "billion dollar mistake[^]", I think it's safe to say null references are bad. Or did you mean System.Nullable<T> in the .NET framework?

                                    Religiously blogging on the intarwebs since the early 21st century: Kineti L'Tziyon Judah Himango

                                    1 Reply Last reply
                                    0
                                    • B Bardy85

                                      Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

                                      T Offline
                                      T Offline
                                      Todd Smith
                                      wrote on last edited by
                                      #31

                                      I usually use them in conjunction with a database and linq. But I don't see why they can't be used whenever the need arises. http://qconlondon.com/london-2009/presentation/Null+References:+The+Billion+Dollar+Mistake[^]

                                      Todd Smith

                                      1 Reply Last reply
                                      0
                                      • S Shog9 0

                                        Bad. But inconsistency is worse. Rather all types be nullable than just a subset...

                                        D Offline
                                        D Offline
                                        Dario Solera
                                        wrote on last edited by
                                        #32

                                        Well, all value types are non-nullable by default. You can make them nullable by wrapping them in a class. This is done automatically in .NET with the "?" operator.

                                        If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki

                                        S 1 Reply Last reply
                                        0
                                        • D Dario Solera

                                          Well, all value types are non-nullable by default. You can make them nullable by wrapping them in a class. This is done automatically in .NET with the "?" operator.

                                          If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki

                                          S Offline
                                          S Offline
                                          Shog9 0
                                          wrote on last edited by
                                          #33

                                          Yeah... And boy is that not slick. :rolleyes:  ("Yay!" i thought to myself, upon hearing of this for the first time... "Now i can write generic code that treats value types and reference types the same!" The gods of .NET proceeded to laugh heartily at my naivete...)

                                          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