Monday 8 September 2008

IsNumeric in C#

IsNumeric doesn't exist in c#, it's VB specific, but i've found to work today is the following:

int result;
Int32.TryParse(value_to_try, out result);

If it can parse an Int, it returns the value to the result variable, if it fails, it returns 0.

Brilliant!

No comments:

Post a Comment