Closed TymurGubayev closed 1 year ago
Following statement isn't quite correct.
An indexer value is not classified as a variable; therefore, you cannot pass an indexer value as a ref or out parameter.
But you can pass an indexer value as a ref, if the indexer uses ref return, like this.
ref
ref return
private readonly int[] arr = new int[10]; public ref int this[int index] { get { return ref arr[index]; } }
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
Thanks for spotting this. We'll get this updated.
Following statement isn't quite correct.
But you can pass an indexer value as a
ref
, if the indexer usesref return
, like this.Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.