We may access the last index of a list/array by the following:
var l = new List<string> {"1", "2a", "3cd"};
Console.WriteLine(l[^1]);
output: "3cd"
May I know if it is possible to cast the string ^1
to index object:
(second line is not working)
var s = "^1"
var index = (Index) s;
Console.WriteLine(l[index]);
To get the output: "3cd"