The following works:
C#
using System;
public class C {
public void M(int[] arr) {
ref int[] x = ref arr[0..2];
}
}
But I'm not sure it should.
馃挱 I would have expected arr[0..2] to produce Span<int>, which is a ref-like type but not ref int[]
Does the indexer copy the array? That is very surprising to me.
Most helpful comment
馃挱 I would have expected
arr[0..2]to produceSpan<int>, which is a ref-like type but notref int[]