System.Exception
if you only plan to handle a System.IO.FileNotFoundException
.try
{
OpenFile("myfile.txt");
}
catch (System.Exception)
{
// some generic handling code
}
try
{
OpenFile("myfile.txt);
}
catch (System.IO.DriveNotFoundException)
{
// inform the user they specified an invalid drive
}
catch (System.IO.FileNotFoundException)
{
// create the file and retry
}
// etc.