Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slice method in RefEnumerable<T> and ReadOnlyRefEnumerable<T> #1040

Open
risinghero opened this issue Jan 7, 2025 · 2 comments
Open

Slice method in RefEnumerable<T> and ReadOnlyRefEnumerable<T> #1040

risinghero opened this issue Jan 7, 2025 · 2 comments
Labels
feature request 📬 A request for new changes to improve functionality

Comments

@risinghero
Copy link

Overview

Slice method in RefEnumerable and ReadOnlyRefEnumerable 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
@risinghero risinghero added the feature request 📬 A request for new changes to improve functionality label Jan 7, 2025
@Sergio0694
Copy link
Member

Is this not the same as span[.., ..3].GetColumn(0)? 🤔

@risinghero
Copy link
Author

Looks like it is a solution. Though Slice for my purpose will be better and it feels like natural method analogue to span slice or Array slice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request 📬 A request for new changes to improve functionality
Projects
None yet
Development

No branches or pull requests

2 participants