foreach の実行中に例外をキャッチした場合、実行を続行できますか?
foreach (string d in Directory.GetDirectories(path))
{
try
{
foreach (string f in Directory.GetFiles(path))
{
//do something
}
//do something
}
catch
{
// If there is an error in the foreach, I want it to keep on going
}
}
foreach
がすべてのファイルを取得する前に突然終了するため、これを求めています。