string files = Directory.GetFiles("C:\MyDir", "*.*", SearchOption.AllDirectories);
catch (Exception ex)
will also throw the
, so I don't think you'll gain anything by using it instead. I also don't know the condition of the array of files - does it continue on with the operation or stop at the exception? I'd have to try running some code, but then again, you can do that yourself.