What's New in C# 13
learn.microsoft.com
learn.microsoft.com
// As written
HandleMultiple(1, 2, 3, 4)
// As compiled
var buffer = new InlineArrayInt4().AsSpan();
buffer[0] = 1;
buffer[1] = 2;
buffer[2] = 3;
buffer[3] = 4;
HandleMultiple(buffer);
And if the argument buffer is not mutable aka ReadOnlySpan<T>, C# can simply emit a static RVA array embedded into assembly, a constant (provided all arguments are constants too).Today, you can already do so without the feature with collection expressions e.g. HandleMultiple([1, 2, 3, 4]) but C# 13 will automatically switch existing callsites to the new params span overloads, reducing allocations and improving performance for free.