Click here to Skip to main content
15,899,313 members
Home / Discussions / C#
   

C#

 
QuestionRe: opening form Pin
jojoba201025-Jan-10 3:41
jojoba201025-Jan-10 3:41 
AnswerRe: opening form Pin
dan!sh 25-Jan-10 3:54
professional dan!sh 25-Jan-10 3:54 
NewsRe: opening form Pin
jojoba201025-Jan-10 4:12
jojoba201025-Jan-10 4:12 
QuestionCan I make an entire class nullable? Pin
Dewald25-Jan-10 3:20
Dewald25-Jan-10 3:20 
AnswerRe: Can I make an entire class nullable? Pin
Som Shekhar25-Jan-10 3:25
Som Shekhar25-Jan-10 3:25 
GeneralRe: Can I make an entire class nullable? Pin
Dewald25-Jan-10 3:27
Dewald25-Jan-10 3:27 
GeneralRe: Can I make an entire class nullable? Pin
Som Shekhar25-Jan-10 3:33
Som Shekhar25-Jan-10 3:33 
AnswerRe: Can I make an entire class nullable? PinPopular
Luc Pattyn25-Jan-10 3:29
sitebuilderLuc Pattyn25-Jan-10 3:29 
The Nullable stuff applies to value types; reference types are always nullable, as a reference can be null, you don't need anything new for this.

Your compiler error message told you "use of unassigned local variable", which is correct as "myInstance" in your second snippet did not have a value assigned, not even null. (in C# class members have a default value, local members don't).

myClass myInstance=null;
...
if (myInstance == null) ...


Smile | :)

Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
[The QA section does it automatically now, I hope we soon get it on regular forums as well]


GeneralRe: Can I make an entire class nullable? Pin
EliottA25-Jan-10 4:41
EliottA25-Jan-10 4:41 
GeneralRe: Can I make an entire class nullable? Pin
Dewald25-Jan-10 5:59
Dewald25-Jan-10 5:59 
GeneralRe: Can I make an entire class nullable? Pin
Luc Pattyn25-Jan-10 6:09
sitebuilderLuc Pattyn25-Jan-10 6:09 
Questionregex help [modified] Pin
uglyeyes25-Jan-10 2:54
uglyeyes25-Jan-10 2:54 
AnswerRe: regex help Pin
Luc Pattyn25-Jan-10 2:56
sitebuilderLuc Pattyn25-Jan-10 2:56 
AnswerRe: regex help Pin
#realJSOP25-Jan-10 3:36
professional#realJSOP25-Jan-10 3:36 
GeneralRe: regex help Pin
uglyeyes25-Jan-10 12:01
uglyeyes25-Jan-10 12:01 
GeneralRe: regex help Pin
uglyeyes26-Jan-10 1:16
uglyeyes26-Jan-10 1:16 
GeneralRe: regex help Pin
uglyeyes26-Jan-10 18:06
uglyeyes26-Jan-10 18:06 
GeneralRe: regex help Pin
#realJSOP26-Jan-10 23:26
professional#realJSOP26-Jan-10 23:26 
GeneralRe: regex help Pin
uglyeyes27-Jan-10 10:40
uglyeyes27-Jan-10 10:40 
QuestionReactive Extensions snippets - why no output? Pin
Kevin McFarlane25-Jan-10 2:32
Kevin McFarlane25-Jan-10 2:32 
AnswerRe: Reactive Extensions snippets - why no output? Pin
Kevin McFarlane25-Jan-10 4:26
Kevin McFarlane25-Jan-10 4:26 
QuestionIni file for setup project in VS2005 Pin
Sunshine Always25-Jan-10 2:04
Sunshine Always25-Jan-10 2:04 
AnswerRe: Ini file for setup project in VS2005 Pin
#realJSOP25-Jan-10 3:38
professional#realJSOP25-Jan-10 3:38 
QuestionRe: Ini file for setup project in VS2005 Pin
Sunshine Always12-Apr-10 0:19
Sunshine Always12-Apr-10 0:19 
Questionmenustrip dynamic items Pin
Zeyad Jalil25-Jan-10 1:46
professionalZeyad Jalil25-Jan-10 1:46 

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.