Move a few stackallocs out of loops#34149
Conversation
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs
Show resolved
Hide resolved
|
One example where value arrays could be handy. You could do the following inside the loop or outside and either way it would work as expected: byte[256] buffer = default;
for (int i = 0; i < buffer.Length; i++)
buffer[i] = ... ;
byte* ptrNeeded = &buffer[0];
. . . |
Did you mean pinned arrays? If not, what's a value array? |
|
Oh, I see, your syntax |
|
Yes. That would be just a struct with a length and indexer. (like Go arrays) |
|
You could use pinned array also. |
Yeah i considered doing that and decided it wasn't :) |
cc: @bartonjs, @jkotas