次の進捗状況を追跡する最良の方法は何ですか?
long total = Products.LongCount();
long current = 0;
double Progress = 0.0;
Parallel.ForEach(Products, product =>
{
try
{
var price = GetPrice(SystemAccount, product);
SavePrice(product,price);
}
finally
{
Interlocked.Decrement(ref this.current);
}});
進捗変数を 0.0 から 1.0 (現在/合計) に更新したいのですが、並列処理に悪影響を与えるようなものは使用したくありません。