dotnet
dotnet copied to clipboard
Slice method in RefEnumerable<T> and ReadOnlyRefEnumerable<T>
Overview
Slice method in RefEnumerable<T> and ReadOnlyRefEnumerable<T> analogue to Slice method of Span.
API breakdown
namespace CommunityToolkit.SomePackage;
public class ReadOnlyRefEnumerable<T>
{
public ReadOnlyRefEnumerable<T> Slice(int start,int length);
}
Usage example
var span=new Span2D<double>(5,5);//matrix representation
span.GetColumn(0)[..3];//get 3 values from matrix
### Breaking change?
No
### Alternatives
Alternative is to copy everything to span.
### Additional context
_No response_
### Help us help you
Yes, I'd like to be assigned to work on this item
Is this not the same as span[.., ..3].GetColumn(0)? 🤔
Looks like it is a solution. Though Slice for my purpose will be better and it feels like natural method analogue to span<T> slice or Array<T> slice.