Skip to content

Instantly share code, notes, and snippets.

@dsibinski
Last active February 11, 2019 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsibinski/798ba2d501ecdbca5c4fe29e5c4ff5a3 to your computer and use it in GitHub Desktop.
Save dsibinski/798ba2d501ecdbca5c4fe29e5c4ff5a3 to your computer and use it in GitHub Desktop.
var array = new[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H' };
Index idx1 = 2; // 2nd element from the beginning
Index idx2 = ^3; // 3rd element from the end (^)
Console.WriteLine($"{array[idx1]}, {array[idx2]}"); // prints "C, F"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment