DivideByZeroException [英] DivideByZeroException

查看:66
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆