code_junkie

Catching base Exception class in .NET

Nov 11th, 2011
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. catch (Exception ex)
  2.  
  3. catch (Exception ex){}
  4.  
  5. catch (Exception ex){ return false; }
  6.  
  7. catch (Exception ex)
  8.  
  9. try {something} catch (SqlException) {do stuff} catch (Exception) {do other stuff}
  10.  
  11. try {
  12. myThing.DoStuff();
  13. }
  14. catch (StuffGoneWrongException ex) {
  15. //figure out what you need to do or bail
  16. }
Add Comment
Please, Sign In to add comment