Hi, a quick question about try / catch syntaxing... Is it possible to have one catch statement catch multiple exception types, and if so what is the syntax Here's an example of what I'm trying to do:
try
{
//
// do some stuff here
//
}
catch (DirectoryNotFoundException ex)
{
MessageBox.Show("Unable to find files!");
}
catch (FileNotFoundException ex2)
{
MessageBox.Show("Unable to find files!");
}
catch (Exception ex3)
{
MessageBox.Show("Unable to find files!");
}
As you can see, the above code handles three exception types with the exact same result... how can I put them all in one catch {} block As in:
try
{
//
// do some stuff here
//
}
catch (DirectoryNotFoundException, FileNotFoundException, Exception ex)
{
MessageBox.Show("Unable to find files!");
}