Unfortunately to do so, it must rely on an exception to detect a invalid value which is a little bit of a performance hit.
public static bool IsNumeric(object value)
{
bool returnValue = false;
try
double check = double.Parse(value.ToString(), NumberStyles.Any, NumberFormatInfo.CurrentInfo);
returnValue = true;
}
catch
{}
return returnValue;
I would think that this would also work in normal C# applications.
Tip Submitted By: David McCarter