The magic code to do this is
int dummyInt;
if(Int32.TryParse(months,out dummyInt))
return "Yes, it is integer";
else
return "No, it is not an integer";
Some people use Int32.Parse and use try-catch block. But that option is not as quick as this.
Technorati Tags: IsNaN C#,C# IsNumber
IceRocket Tags: IsNaN C#,C# IsNumber
No comments:
Post a Comment