DivideByZeroException [英] DivideByZeroException
问题描述
偏移量将为零,有人可以告诉我原因并帮助我解决此问题。我在循环期间遇到DivideByZeroException异常,因为偏移量变为为零
The offset is going to zero, can someone tell me why and help me resolve this issue. I get a DivideByZeroException exception during the loop because the offset goes to zero
&NBSP; &NBSP; for(int offset = 0; offset< = File.Length; offset + = buffersize)
for (int offset = 0; offset <= File.Length; offset += buffersize)
{
&NBSP; &NBSP;
我在循环期间收到DivideByZeroException异常。
I get a DivideByZeroException exception during the loop.
totalspeed = Math.Round((offset /(sw.ElapsedMilliseconds) / 1000))* 0.00000762939453125,1);
totalspeed = Math.Round((offset / (sw.ElapsedMilliseconds / 1000)) * 0.00000762939453125, 1);
}
pianoboyCoder
pianoboyCoder
推荐答案
添加" if(sw.ElapsedMilliseconds> 0)"在分裂前划线?
Add "if (sw.ElapsedMilliseconds > 0)" to be line before the division?
这篇关于DivideByZeroException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!