如何处理在一个循环的异常,并保持迭代? [英] How handle an exception in a loop and keep iterating?
本文介绍了如何处理在一个循环的异常,并保持迭代?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个循环,将完成所有迭代即使有在迭代的任何一个任何异常。
解决方案
的(...)
{
试
{
//做的东西
}
赶上(异常前)
{
//处理(或忽略)异常
}
}
I need a for loop which will complete all its Iterations even if there's any exception in any one of the iterations.
解决方案
for (...)
{
try
{
// Do stuff
}
catch (Exception ex)
{
// Handle (or ignore) the exception
}
}
这篇关于如何处理在一个循环的异常,并保持迭代?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文