Created
April 2, 2012 10:43
-
-
Save jchannon/2282494 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void DoSomething(string Data) | |
{ | |
int localVar = int.Parse(Data.ToString)); //BOOM! Exception | |
} | |
//I need to make sure I handle this otherwise users aren't going to be happy | |
public void DoSomething(string Data) | |
{ | |
try | |
{ | |
int localVar = int.Parse(Data.ToString)); //BOOM! Exception | |
} | |
catch(NullReferenceException ex) | |
{ | |
//Catch it and notify user | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment