There is no inbuilt IsNumeric function in C#. The function below does the same as the isNumeric function does in VB
public static bool IsNumeric(string
s)
{
decimal result;
decimal.TryParse(s, out
result);
if (result!=0)
{
return true;
}
else
{
decimal.TryParse((s + 1), out
result);
if (result != 0)
{
return true;
}
else
{
return false;
}
}
}
No comments:
Post a Comment
Comments will appear once they have been approved by the moderator