.NET Community Toolkit is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. The toolkit is maintained and published by Microsoft, and part of the .NET Foundation.
A constructor for the Span2D<T> to create a 2D view over a Span<T>. Currently only arrays and pointers but I believe a Span would also be suitable. In fact, I think I can see an implementation already there, it's just marked as internal.
API breakdown
public readonly ref partial struct Span2D<T>
{
// ...
public Span2D(Span<T> span, int height, int width) : this (span, 0, height, width, 0) {...}
public Span2D(Span<T> span, int offset, int height, int width, int pitch) {...}
// ...
}
Usage example
Span<int> p = stackalloc int[9];
Span2D<int> span = new Span2D<int>(p, 3, 3);
Overview
A constructor for the
Span2D<T>
to create a 2D view over aSpan<T>
. Currently only arrays and pointers but I believe aSpan
would also be suitable. In fact, I think I can see an implementation already there, it's just marked as internal.API breakdown
Usage example
Breaking change?
No
Alternatives
Additional context
No response
Help us help you
Yes, but only if others can assist