Skip to content

Why Can't I stackalloc delegates? #71618

Answered by huoyaoyuan
Xyncgas asked this question in Q&A
Discussion options

You must be logged in to vote

You can't stackalloc for any reference type either.
The direct reason is that the result of stackalloc IL instruction is a pointer. The span is synthesized by C# compiler.
There is already a proposal to enable stackalloc for reference type: #11192

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by teo-tsirpanis
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants