Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Index and Ranges Changes #35003

Closed
wants to merge 4 commits into from
Closed

Conversation

tarekgh
Copy link
Member

@tarekgh tarekgh commented Jan 31, 2019

@tarekgh
Copy link
Member Author

tarekgh commented Jan 31, 2019

@tarekgh tarekgh added the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label Jan 31, 2019
public static System.Span<T> AsSpan<T>(this T[] array) { throw null; }
public static System.Span<T> AsSpan<T>(this T[] array, int start) { throw null; }
public static System.Span<T> AsSpan<T>(this T[] array, int start, int length) { throw null; }
public static Span<T> AsSpan<T>(this T[] array, Index startIndex) { throw null; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are adding Index/Range overloads to AsSpan for array/segment, why not add it for string as well?

public static System.ReadOnlySpan<char> AsSpan(this string text, int start, int length) { throw null; }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good question, I don't think this was discussed and I don't see a strong reason why we shouldn't have it. but in general it is easy to achieve the same with the current APIs String.AsSpan().Slice(Index/Range)

@terrajobst what you think about this one?

@stephentoub
Copy link
Member

Cherry-picked into #35207

@stephentoub stephentoub closed this Feb 9, 2019
@karelz karelz added this to the 3.0 milestone Mar 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
* NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons)
Projects
None yet
4 participants