Created
October 18, 2009 21:08
-
-
Save atifaziz/212858 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
// http://twitter.com/raboof/statuses/4974353119 | |
static partial class TryParse | |
{ | |
public static int? Int32(string str) | |
{ | |
return Int32(str, null); | |
} | |
public static int? Int32(string str, int? defaultValue) | |
{ | |
int result; | |
return int.TryParse(str, out result) ? result : defaultValue; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment