In C# should try-catch be used for is-numeric testing? -


I have heard that the use of exception trapping is not a recommended practice for a number test.

For example:

Try the bool numeric {int i = int.parse (textbox1.text); Numerical = true; } Hold {isnumenric = false}

Is there any other way that I can test for numbers in C #?

Try to use yes

  int i; Bool success = Int32.TryParse (textBox1.text, I'm out);  

The TryParse method basically does what you are up to.


Comments