Skip to content

Instantly share code, notes, and snippets.

@hakandilek
Last active December 20, 2015 18:08
Show Gist options
  • Save hakandilek/6173526 to your computer and use it in GitHub Desktop.
Save hakandilek/6173526 to your computer and use it in GitHub Desktop.
bool success;
try
{
// (A) save context first time
success = true;
}
catch (Exception)
{
success = false; // value is not used in any execution path
throw;
}
if (success) // expression is always true?
{
// (B) save context second time
}
bool success = false;
try
{
// (A) save context first time
success = true;
}
finally
{
if (success)
{
// (B) save context second time
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment