Home » CodeDigest


Validate if a string is valid number or Integer in C#
Submitted By James Curran
On 11/8/2010 8:58:24 AM
Tags: CodeDigest  

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);




Console.Write("{0} is not a valid number!", number);


Do you have a working code that can be used by anyone? Submit it here. It may help someone in the community!!

Recent Codes
  • View All Codes..