CommunityToolkit / CommunityToolkit/dotnet

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

Open
#1,040 2 comments 0 reactions 0 assignees View on GitHub
feature request :mailbox_with_mail:
Dominant language
C#
Stars
3.8k
Forks
400
PR merge metrics
No merged PRs in 30d

Description

### Overview

Slice method in RefEnumerable and ReadOnlyRefEnumerable analogue to Slice method of Span.

### API breakdown

```csharp
namespace CommunityToolkit.SomePackage;

public class ReadOnlyRefEnumerable
{
public ReadOnlyRefEnumerable Slice(int start,int length);
}
```

### Usage example

```csharp
var span=new Span2D(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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.