Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created September 7, 2019 17:01
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 IntegerMan/0492401853d83fe8ea53a5226d5cf5b3 to your computer and use it in GitHub Desktop.
Save IntegerMan/0492401853d83fe8ea53a5226d5cf5b3 to your computer and use it in GitHub Desktop.
try {
DoSomethingRisky();
} catch (InvalidOperationException ex) {
if (ex.Message.StartsWith("Cannot access the")) {
// Some specialized handling logic
} else {
throw; // The ex is implicit
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment