C
C#15mo ago
16Bit_Felix

❔ Structure keeps on nulling a field

Hello, there. I'm currently struggling with a problem, which includes a struct of mine that keeps on nulling an uint[] field named "_indices" (which is initialised with a field initialiser) after exiting the constructor. I've tried to initialise it in the constructor instead, but to no avail... Turning the struture into a class seems to fix the problem, but i would like to keep it as a struct
5 Replies
16Bit_Felix
16Bit_FelixOP15mo ago
The source code:
Pobiega
Pobiega15mo ago
Why do you want to keep it a struct? arrays are reference types, so this struct of yours will go on the heap regardless
16Bit_Felix
16Bit_FelixOP15mo ago
because of pointers
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?