【发布时间】:2012-05-04 17:38:28
【问题描述】:
在 vs 2010 或第三方应用程序中,有什么方法可以针对所有可能的异常自动生成方法可以抛出的“catch”?
例如,如果我使用“Directory.CreateDirectory”,它将自动创建:
try
{
Directory.CreateDirectory("blabla");
}
catch (PathTooLongException)
{}
catch (DirectoryNotFoundException)
{}
catch (IOException)
{}
catch (ArgumentNullException)
{}
catch (UnauthorizedAccessException)
{}
【问题讨论】:
标签: c# visual-studio-2010 try-catch code-snippets