Corefxlab: Slices and ref locals and returns

Created on 6 Feb 2016  路  3Comments  路  Source: dotnet/corefxlab

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

All 3 comments

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

``` C#
public static ref T AsRef(this Span span)

// usage
ref var header = buffer.AsRef

();

 If future C# has `readonly ref` returns:

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

Yeah, definitely we would add something like that.

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

Was this page helpful?
0 / 5 - 0 ratings