+ 1

Why variables should not be initialized in a structure in c#?

26th Oct 2017, 3:30 PM
Jyoti
Jyoti - avatar
2 Antworten
+ 3
Which language referred? mark your question with proper tag
26th Oct 2017, 4:02 PM
Ipang
+ 1
I don't know if this is the right answer for you, but in the past, when I use structures, their members can be initialized as necessary, for example, structures that contains variable length of data, they usually comes with a member wherein we can assign a value that describes the amount of data is allocated for the variable length member buffer, so any function that works with the structure "knows" how much data can be written in it, to prevent buffer overflow (insufficient buffer). Maybe you can link your code/snippet here, to show what you mean, so to have a clear view on the matter. More people will likely to help if it's clearly defined :) Hth, cmiiw
27th Oct 2017, 7:21 AM
Ipang