posted on Thursday, April 22, 2004 6:28 PM by warstar

IsNumeric in C#

Hey just survived the hell called school and bad organisation but now i'm gone start blogging again.

When i was reading thro one of the blogs i found a reverence to a function called Isnumeric but it's only there for VB.NET so i had to find/make me one. Here is a solution to the problem:

public static bool IsNumeric(object value)
{
        try 
       

                int i = Convert.ToDouble(value.ToString());
                return true
        
        catch (FormatException) 
       
                return false;
        }
}

I know it's not what the vb version is doing but hey it works :D

Good luck all Weeee i have a post witch has 1100 web views

Comments