int[] numbers = new int[10];
numbers[9] = 10;
Console.Write(numbers[^1] == numbers[numbers.Count()-1]); //true
How does index of ^1
returns the last item in an array?
What does ^1
mean in C# compiler?
Does it have performance benefit vs numbers[numbers.Count()-1]
?
numbers[^1]
is the same with numbers[length-1]
They are called ranged operators in C# 8. Check this link for more details.