Click here to Skip to main content
15,906,816 members

Survey Results

Do you use null values or magic numbers?   [Edit]

Survey period: 11 Dec 2006 to 17 Dec 2006

Many languages allow you to store null values in place of actual data. If you have no data for a value do you null it or store, say, -1?

OptionVotes% 
I always use null values in code49937.18
It depends on the situation74255.29
I never use null values in code1017.53



 
GeneralIn C#, please use MinValue or MaxValue. Pin
Dale Thompson12-Dec-06 7:23
Dale Thompson12-Dec-06 7:23 
GeneralRe: In C#, please use MinValue or MaxValue. Pin
Ri Qen-Sin12-Dec-06 13:37
Ri Qen-Sin12-Dec-06 13:37 
GeneralRe: In C#, please use MinValue or MaxValue. Pin
Kamarey16-Dec-06 22:42
Kamarey16-Dec-06 22:42 
GeneralRe: In C#, please use MinValue or MaxValue. Pin
jhwurmbach18-Dec-06 2:38
jhwurmbach18-Dec-06 2:38 
GeneralRe: In C#, please use MinValue or MaxValue. Pin
Ri Qen-Sin22-Dec-06 14:09
Ri Qen-Sin22-Dec-06 14:09 
GeneralThe default keyword Pin
WillemM11-Dec-06 5:40
WillemM11-Dec-06 5:40 
GeneralRe: The default keyword Pin
Steve Hansen12-Dec-06 23:03
Steve Hansen12-Dec-06 23:03 
GeneralDBNull Pin
Marc Clifton11-Dec-06 2:18
mvaMarc Clifton11-Dec-06 2:18 
Null and DbNull are two different things, and given that most of what I work with ends up persisting to a database where DbNull has meaning and relevance, I find myself dealing with how a DbNull is represented to the user (not to mention internally). It's a shame that there isn't better coupling between C#'s nullable types and the DB persistence framework. What I'd like to see is more thought put into the entire issue of database, internal, and UI representation of nullable fields and default values and how they are handled. As it is, I have to write code to do all that manually, which is fine, but it seems like it's something that the C# language and .NET framework could address.

Marc




Thyme In The Country

People are just notoriously impossible. --DavidCrow
There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer
People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith


GeneralRe: DBNull Pin
Kevin McFarlane17-Dec-06 8:46
Kevin McFarlane17-Dec-06 8:46 
Generalnull value isn't always undesirable Pin
redclover11-Dec-06 1:38
redclover11-Dec-06 1:38 
GeneralNo-value is different from null-value Pin
Emilio CL10-Dec-06 23:38
Emilio CL10-Dec-06 23:38 
GeneralNullable types in C# rock. Pin
stano10-Dec-06 23:09
stano10-Dec-06 23:09 
GeneralIt's convenient Pin
Michael Dunn10-Dec-06 18:47
sitebuilderMichael Dunn10-Dec-06 18:47 
GeneralRe: It's convenient Pin
Jörgen Sigvardsson12-Dec-06 11:44
Jörgen Sigvardsson12-Dec-06 11:44 
Generalit depends Pin
Pharago10-Dec-06 18:03
Pharago10-Dec-06 18:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.