Resuming execution of code after exception is thrown and caught
Posted
by dotnetdev
on Stack Overflow
See other posts from Stack Overflow
or by dotnetdev
Published on 2010-06-09T16:01:46Z
Indexed on
2010/06/09
16:12 UTC
Read the original article
Hit count: 281
Hi,
How is it possible to resume code execution after an exception is thrown?
For exampel, take the following code:
namespace ConsoleApplication1
{
class Test
{
public void s()
{
throw new NotSupportedException();
string @class = "" ;
Console.WriteLine(@class);
Console.ReadLine();
}
}
class Program
{
static void Main(string[] args)
{
try
{
new Test().s();
}
catch (ArgumentException x)
{
}
catch (Exception ex) { }
}
}
}
After catching the exception when stepping through, the program will stop running. How can I still carry on execution?
Thanks
© Stack Overflow or respective owner