Thursday, February 24, 2011

How to use IsNumeric function in C#.Net

Hi all,

If we want to check a given stringg is numeric ot not we have built-in function in Vb.Net but what about in C#.Net?
I tried to build my own function in C#, here is the list of ways to achive the above functionality.
We can use any of the below method to check the given string is numeric or not.

  • Using parse method of Int:














  • Using tryparse method of Int:
  • By looping through the string arrary:
  • 
    
  • By using regular expression:








  • By using the in built IsNumeric function of visual basic:
  • 





No comments:

Post a Comment