Parameterless constructor in struct
Then public
MyStruct[] myStruct = new MyStruct[100];
should call the MyStruct() constructor 100 times.
How can I do this?8 Replies
XY problem if I ever saw one, but you'd need
count
to be static for this to work
and even so, I dont think that array construction would work the way you expect anywaysyeah I made a mistake but it won't let me edit the body of the post
why you abandoned your previous but almost similar post and make a new one, instead?
The title makes more sense in this one and is more explanatory
you need a factory
the factory should have the count
and assign the id
if you're doing the same for all types, all the more reason for it to be implemented separately
Array elements are always created using the default value for the element’s type.
Which does not involve the zero-param ctor.
Ah ok I see
Thank you I will look into this
there is an
Array.Initialize
for this though