Click here to Skip to main content
15,900,516 members
Home / Discussions / C#
   

C#

 
AnswerRe: Changing a Struct Property Value PinPopular
harold aptroot10-Apr-15 12:31
harold aptroot10-Apr-15 12:31 
AnswerRe: Changing a Struct Property Value Pin
OriginalGriff10-Apr-15 22:03
mveOriginalGriff10-Apr-15 22:03 
AnswerRe: Changing a Struct Property Value Pin
BillWoodruff10-Apr-15 22:53
professionalBillWoodruff10-Apr-15 22:53 
GeneralRe: Changing a Struct Property Value Pin
Richard Deeming13-Apr-15 1:31
mveRichard Deeming13-Apr-15 1:31 
GeneralRe: Changing a Struct Property Value Pin
BillWoodruff13-Apr-15 1:49
professionalBillWoodruff13-Apr-15 1:49 
GeneralRe: Changing a Struct Property Value Pin
Richard Deeming13-Apr-15 2:02
mveRichard Deeming13-Apr-15 2:02 
GeneralRe: Changing a Struct Property Value Pin
Kevin Marois13-Apr-15 3:06
professionalKevin Marois13-Apr-15 3:06 
GeneralRe: Changing a Struct Property Value Pin
Richard Deeming13-Apr-15 4:12
mveRichard Deeming13-Apr-15 4:12 
You shouldn't be able to compile the code without it - you'll get compiler error CS0188[^] - "The 'this' object cannot be used before all of its fields are assigned to".
  • All fields in a struct have to be assigned by a constructor before the constructor can call a method in the struct.
  • Setting a property counts as calling a method on the struct, which you can't do until all of the fields have been assigned.
  • Since you're using an automatic property, you can't directly access the backing field to initialize it.
  • Therefore, the only way to initialize the field is to call the default parameterless constructor first.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


QuestionC# Memory Leak Question Pin
Kevin Marois10-Apr-15 10:45
professionalKevin Marois10-Apr-15 10:45 
AnswerRe: C# Memory Leak Question Pin
jschell10-Apr-15 11:36
jschell10-Apr-15 11:36 
GeneralRe: C# Memory Leak Question Pin
Kevin Marois13-Apr-15 3:13
professionalKevin Marois13-Apr-15 3:13 
QuestionEasy Way to Display Multilingual Tooltip and Message Box Pin
Felix Obere10-Apr-15 10:03
Felix Obere10-Apr-15 10:03 
Questionconvert piece of code from C++ to C# Pin
MrKBA10-Apr-15 8:25
MrKBA10-Apr-15 8:25 
AnswerRe: convert piece of code from C++ to C# Pin
RedDk12-Apr-15 16:49
RedDk12-Apr-15 16:49 
Questionsingle quote inside double quote in C# ASP.NET Pin
Rajeshkunwar2510-Apr-15 3:42
Rajeshkunwar2510-Apr-15 3:42 
AnswerRe: single quote inside double quote in C# ASP.NET Pin
OriginalGriff10-Apr-15 3:57
mveOriginalGriff10-Apr-15 3:57 
QuestionI can't get my splash screen to close Pin
jkirkerx9-Apr-15 11:00
professionaljkirkerx9-Apr-15 11:00 
AnswerRe: I can't get my splash screen to close Pin
Herman<T>.Instance9-Apr-15 23:54
Herman<T>.Instance9-Apr-15 23:54 
GeneralRe: I can't get my splash screen to close Pin
jkirkerx10-Apr-15 6:25
professionaljkirkerx10-Apr-15 6:25 
AnswerRe: I can't get my splash screen to close Pin
Richard MacCutchan10-Apr-15 2:20
mveRichard MacCutchan10-Apr-15 2:20 
GeneralRe: I can't get my splash screen to close Pin
jkirkerx10-Apr-15 6:46
professionaljkirkerx10-Apr-15 6:46 
GeneralRe: I can't get my splash screen to close Pin
Richard MacCutchan10-Apr-15 6:50
mveRichard MacCutchan10-Apr-15 6:50 
GeneralRe: I can't get my splash screen to close Pin
jkirkerx10-Apr-15 7:38
professionaljkirkerx10-Apr-15 7:38 
QuestionApplication.Run(new FormMain()); does not contain a constructor that takes 0 arguments Pin
jkirkerx9-Apr-15 7:02
professionaljkirkerx9-Apr-15 7:02 
AnswerRe: Application.Run(new FormMain()); does not contain a constructor that takes 0 arguments Pin
Richard Deeming9-Apr-15 7:05
mveRichard Deeming9-Apr-15 7:05 

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.