How to check if a String is Integer in C#? (Part 2)
In addition to the methods given yesterday by Bala Murugan, I believe this method will work best:
string number = "100";
if (number.All(Char.IsDigit))
{
Console.Write("{0} is a valid number!", number);
}
else
{
Console.Write("{0} is not a valid number!", number);
}
|