←back to thread

.NET 10

(devblogs.microsoft.com)
489 points runesoerensen | 1 comments | | HN request time: 0.205s | source
1. kfuse ◴[] No.45898738[source]
Updated a pet project of mine and got a minor break:

  var pixels = new uint[renderers.width * renderers.height];
  var pixels2 = MemoryMarshal.Cast<uint, ulong>(pixels);
  pixels2[idx] = ...
In NET9.0 pixels2 were Span<ulong>, but in NET10.0 a different MemoryMarshal.Cast overload is used and it is ReadOnlySpan<ulong> now, so the assignment fails.

Spans is such a fundamental tool for low level programming. It is really unfortunate they were added relatively late to the language. Now every new version includes a slew of improvements related to them but they will never be as good as if they were there from the start or at least as early as generics were.