Skip to content

Instantly share code, notes, and snippets.

@jjhamshaw
Created June 10, 2012 13:20
Show Gist options
  • Save jjhamshaw/2905560 to your computer and use it in GitHub Desktop.
Save jjhamshaw/2905560 to your computer and use it in GitHub Desktop.
how to throw an exception
class ExceptionThrowingExample
{
public void DoSomething()
{
Console.WriteLine("Starting to do something...");
throw new Exception();
//Will never be called. The throw command terminates the program...
Console.WriteLine("...finished doing something.");
}
}
@jjhamshaw
Copy link
Author

"Console.WriteLine("...finished doing something.");" will never be called. The throw command terminates the program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment