Skip to content

Instantly share code, notes, and snippets.

@christiannagel
Last active July 10, 2018 19:15
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 christiannagel/97c2103b20ac932e875049199639080c to your computer and use it in GitHub Desktop.
Save christiannagel/97c2103b20ac932e875049199639080c to your computer and use it in GitHub Desktop.
Hat Operator using C# 8
var last = ^1;
int[] arr = { 1, 2, 3 };
int lastItem = arr[last];
Console.WriteLine(lastItem);
int lastItem2 = arr[arr.Length - 1];
Console.WriteLine(lastItem2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment