// C# Span<byte> buffer = stackalloc byte[1024];
So either do something like
using MyStructType something = new MyStructType ()
myVar.WithXYZResource(res => { /* .... */ })
This from C# point of view, in something like D, there would be another set of considerations.
Still much easier than "in your face ownership management" though, yes.