P
PeteZ
or do I have to iterate the string and use Char.IsNumber ?
Sheila Jones said:I think I read somewhere that you shouldn't use exceptions for simple
testing like this - raising exceptions is expensive, so they should only be
used to detect exceptional occurrences.
Maybe somebody can confirm/deny this?
PeteZ said:or do I have to iterate the string and use Char.IsNumber ?
Shawn B. said:If you write a function of your own, called IsNumeric, then according to the
.NET guidelines, it should only return true or false and catch any
exceptions that may ocurr, but it can't propagate any exceptions to the
concumer. So you get get either true or you get false but you'll never get
an exception. So you can handle the exception, just don't rely on it. Do
what you can to anticipate it before it happens and he'll be fine.
Thanks,
Shawn
only
Sheila Jones said:I think a problem with this is that you will still get thrown in to the
debugger if you're debugging with the 'break into the debugger when an
exception is thrown' option switched on.
I'm still not really convinced about using exceptions as a way to control
ordinary program flow...