-
I am want putting all in stack. But my code not compiled. I dont undetstand why. public ref struct MyStr internal class Program
} Can you describe? |
Beta Was this translation helpful? Give feedback.
Answered by
gfoidl
Nov 15, 2023
Replies: 1 comment
-
Because You could
to work around this. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
P9avel
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because
MyStr
is used as type argument forT
inSpan<T>
, andref struct
s are not allowed as type arguments.You could
MyStr* a = stackalloc MyStr[10];
[InlineArray]
(.NET 8)to work around this.