On Jun 27, 11:00 pm, Andrew <And...@discussions.microsoft.comwrote:
Hello, friends,
In VB6, we have function IsNumeric(). What is the correpsonding function in
c#.net?
Thanks.
This is what I've found when searching through
www.google.com/codesearch,
i've put it in a class for easy access throughout the application:
/// <summary>
/// Returns whether an object is numeric or not
/// </summary>
/// <param name="o">object to check</param>
/// <returns>boolean true/false</returns>
public static bool IsNumeric(object o)
{
if (o is IConvertible)
{
TypeCode tc = ((IConvertible)o).GetTypeCode();
if (TypeCode.Char <= tc && tc <= TypeCode.Decimal)
return true;
}
return false;
}