尝试计算完成百分比时我在这里遗漏了什么?我的百分比方程似乎返回了不正确的百分比。
Int32 counter = 0;
foreach (var vehicle in vehicles)
{
counter += 1;
Int32 percentage = (Int32)((double)counter * vehicles.Count()) / 100;
_worker.ReportProgress(percentage);
if (_worker.CancellationPending)
{
e.Cancel = true;
_worker.ReportProgress(0);
return;
}
}