Skip to content

Instantly share code, notes, and snippets.

@HamidMosalla
Last active March 6, 2018 21:21
Show Gist options
  • Save HamidMosalla/20b55745b15ee3120122eb02174723fb to your computer and use it in GitHub Desktop.
Save HamidMosalla/20b55745b15ee3120122eb02174723fb to your computer and use it in GitHub Desktop.
static int GetValueFromArray(int[] array, int index)
{
try
{
return array[index];
}
catch (System.IndexOutOfRangeException ex)
{
throw new ArgumentOutOfRangeException("Index is out of range", "index", ex);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment