G
Guest
Hi,
I have something like this:
try
{
// some code
}
catch // note - i am catching everything now
{
// do something
}
Will this sort of catch statement, catch 'unsafe' and 'kernal-level'
exceptions (even if the app is a simple asp.net app with no unsafe stuff)?
(just wanted to confirm as I had a debate with one of my friends - AFAIK i
feel it doesn't since no unsafe code is used and since Win32 exceptions are
mapped into managed .NET exception classes)
Also, in many cases, i have catch blocks which does nothing - because i
don't want any exception to be propagated...something like follows.
public bool IsInteger(string val)
{
bool result;
try
{
int.Parse(val);
result = true;
}
catch
{
result = false;
}
return result;
}
Is this OK (a good practice)?
Thanks,
Benny
I have something like this:
try
{
// some code
}
catch // note - i am catching everything now
{
// do something
}
Will this sort of catch statement, catch 'unsafe' and 'kernal-level'
exceptions (even if the app is a simple asp.net app with no unsafe stuff)?
(just wanted to confirm as I had a debate with one of my friends - AFAIK i
feel it doesn't since no unsafe code is used and since Win32 exceptions are
mapped into managed .NET exception classes)
Also, in many cases, i have catch blocks which does nothing - because i
don't want any exception to be propagated...something like follows.
public bool IsInteger(string val)
{
bool result;
try
{
int.Parse(val);
result = true;
}
catch
{
result = false;
}
return result;
}
Is this OK (a good practice)?
Thanks,
Benny