C# has "^n" notation that means "length - n". For example:
Take the last element of an array or any other structure that supports indices:
var a = ar[^1];
var lastThree = ar[^3..];
C# has "^n" notation that means "length - n". For example:
Take the last element of an array or any other structure that supports indices:
Take the last three elements of an array or any other data structure that supports ranges: