Version Used: 16.6 Preview 2
Steps to Reproduce:
struct S
{
public ref S Slice(int start, int length) => throw null;
public int Length { get; }
public S this[System.Range r] { get => default; }
}
class C
{
void Goo(S s)
{
s.Slice(1, s.Length - 2) = default;
}
}
Expected Behavior:
No code fix is offered to convert the Slice call to a range operator.
Actual Behavior:
The call is converted to this:
The result does not compile because the indexer is read only.
error CS0200: Property or indexer 'S.this[Range]' cannot be assigned to -- it is read only
Version Used: 16.6 Preview 2
Steps to Reproduce:
Expected Behavior:
No code fix is offered to convert the
Slicecall to a range operator.Actual Behavior:
The call is converted to this:
The result does not compile because the indexer is read only.