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

Slices and ref locals and returns #606

Closed
omariom opened this issue Feb 6, 2016 · 3 comments
Closed

Slices and ref locals and returns #606

omariom opened this issue Feb 6, 2016 · 3 comments
Assignees

Comments

@omariom
Copy link
Contributor

omariom commented Feb 6, 2016

As Ref locals and returns are approaching, Slices API should probably take that into account.

@omariom
Copy link
Contributor Author

omariom commented Apr 26, 2016

For example, Span<byte> could have the following extension method (name can be different):

public static ref T AsRef<T>(this Span<byte> span)

// usage
ref var header = buffer.AsRef<Header>();

If future C# has readonly ref returns:

public static readonly ref T AsRef<T>(this ReadOnlySpan<byte> span)

@KrzysztofCwalina
Copy link
Member

Yeah, definitely we would add something like that.

@KrzysztofCwalina
Copy link
Member

per API review (https://github.com/dotnet/apireviews/tree/master/2016/11-04-SpanOfT) we will add ref returning indexer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants