Click here to Skip to main content
15,906,625 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to Create Zoom In/Out for Text Pin
OriginalGriff15-Jun-11 3:27
mveOriginalGriff15-Jun-11 3:27 
GeneralRe: How to Create Zoom In/Out for Text Pin
BobJanova15-Jun-11 4:05
BobJanova15-Jun-11 4:05 
QuestionIs it possible to change the remote SQL Server Job Start time in C# Pin
Vimalsoft(Pty) Ltd14-Jun-11 23:19
professionalVimalsoft(Pty) Ltd14-Jun-11 23:19 
AnswerRe: Is it possible to change the remote SQL Server Job Start time in C# Pin
Blue_Boy14-Jun-11 23:35
Blue_Boy14-Jun-11 23:35 
GeneralRe: Is it possible to change the remote SQL Server Job Start time in C# Pin
Vimalsoft(Pty) Ltd15-Jun-11 3:24
professionalVimalsoft(Pty) Ltd15-Jun-11 3:24 
GeneralRe: Is it possible to change the remote SQL Server Job Start time in C# Pin
Blue_Boy15-Jun-11 4:01
Blue_Boy15-Jun-11 4:01 
AnswerRe: Is it possible to change the remote SQL Server Job Start time in C# Pin
jschell15-Jun-11 9:01
jschell15-Jun-11 9:01 
QuestionVSTO word addin Pin
adkalavadia14-Jun-11 21:04
adkalavadia14-Jun-11 21:04 
AnswerRe: VSTO word addin Pin
Roger Wright15-Jun-11 21:39
professionalRoger Wright15-Jun-11 21:39 
Questionhow to load and display two images in c# Pin
ankushjain14-Jun-11 20:56
ankushjain14-Jun-11 20:56 
AnswerRe: how to load and display two images in c# Pin
Richard MacCutchan14-Jun-11 22:10
mveRichard MacCutchan14-Jun-11 22:10 
AnswerRe: how to load and display two images in c# Pin
BobJanova15-Jun-11 0:53
BobJanova15-Jun-11 0:53 
QuestionWhat is this line? Pin
AmbiguousName14-Jun-11 20:07
AmbiguousName14-Jun-11 20:07 
AnswerRe: What is this line? Pin
Mycroft Holmes14-Jun-11 20:12
professionalMycroft Holmes14-Jun-11 20:12 
AnswerRe: What is this line? PinPopular
V.14-Jun-11 20:30
professionalV.14-Jun-11 20:30 
AnswerRe: What is this line? Pin
Roger Wright14-Jun-11 20:32
professionalRoger Wright14-Jun-11 20:32 
GeneralRe: What is this line? Pin
Łukasz Nowakowski14-Jun-11 21:07
Łukasz Nowakowski14-Jun-11 21:07 
GeneralRe: What is this line? Pin
Pete O'Hanlon14-Jun-11 21:17
mvePete O'Hanlon14-Jun-11 21:17 
GeneralRe: What is this line? Pin
Łukasz Nowakowski14-Jun-11 21:23
Łukasz Nowakowski14-Jun-11 21:23 
GeneralRe: What is this line? Pin
Roger Wright14-Jun-11 21:25
professionalRoger Wright14-Jun-11 21:25 
GeneralRe: What is this line? Pin
RobCroll14-Jun-11 22:56
RobCroll14-Jun-11 22:56 
GeneralRe: What is this line? Pin
BobJanova15-Jun-11 0:41
BobJanova15-Jun-11 0:41 
To expand on the last reply, it is useful when a variable can validly take the whole range of the type in question, and can also have a 'not set' value. Typically we have either used an invalid value (e.g. testing getchar() for -1 in old school C; -1 is a common 'not set' value in ints still) or created another boolean variable to define whether or not we set a value:
bool customerLikedProduct;
bool customerResponded;


People have also solved that one with a three way enum ...
enum NullableBool { True, False, Maybe }

... but when you do that you lose the ability to use boolean logical operators, compatibility with external data sources or applications, etc.

In these cases, you would like to be able to represent the 'not set' value within one variable. That's what nullable types give you:
bool? customerLikedProduct;


As already mentioned, it's particularly useful for working with databases where null values are a common and standard thing.

For me, using -1 or double.NaN is fine, as long as that can never be a valid value for the variable in question. But there are times when the whole valid range for the natural data type is valid and you should use nullable types.
GeneralHow can I add application configuration file in C# project? Pin
bulbul01198914-Jun-11 18:48
bulbul01198914-Jun-11 18:48 
GeneralRe: How can I add application configuration file in C# project? Pin
Roger Wright14-Jun-11 19:54
professionalRoger Wright14-Jun-11 19:54 
QuestionMessage Removed Pin
14-Jun-11 18:38
nehajain1214-Jun-11 18:38 

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.