4 ms·
There are memory management tools: You can layout a struct (which are value types not class types in c#/dotnet) with LayoutKind attributes: https://learn.micro
by xnorswap 3y ago
There are memory management tools:
You can layout a struct (which are value types not class types in c#/dotnet) with LayoutKind attributes: https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.layoutkind?view=net-8.0 https://learn.microsoft.com/en-us/dotnet/api/system.runtime....
You can also use things like Span<T> and other types for better control.
But honestly C# performs generally so well that it tends to be you only reach for these tools after you spot a performance problem and profile it, which is actually quite rare.
IME most performance problems and solutions still tend to be, "Oh this person took a naive approach here, we can use a specialised loop or data structure to fix that".