You can use double.TryParse () which returns a bool as an out parameter
saying wheather the parse succeeded or not, not exception will be thrown in
any case.
Currently it is not possible to catch multiple exceptions in one catch
block, this feature is called exception filtering and I hope that MS will
include it in one of the next versions of c#, currently it is only available
to vb programmers.
"B.J." <BJ@discussions .microsoft.com> schrieb im Newsbeitrag
news:20******** *************** ***********@mic rosoft.com...
Hi,
Is there any way how I can shorten following code ?
try {...}
catch(FormatExc eption) {SAME CODE IN ALL CATCH BLOCKS}
catch(OverflowE xception) {SAME CODE IN ALL CATCH BLOCKS}
E.g. to this ...
try {...}
catch(FormatExc eption | OverflowExcepti on) {...}
Because I need write same code to all catch blocks ...
Thanks, B.J.