优化并行处理和代码可读性
格式化了 `data.Where` 的条件部分以提高可读性。 将并行度从 1 提升到 8 以提高性能。
This commit is contained in:
parent
83449ea2dd
commit
a10a4371ba
|
@ -196,7 +196,13 @@ public partial class MainViewModel : INotifyPropertyChanged
|
||||||
|
|
||||||
var reportDatas = new ConcurrentBag<ReportModel>();
|
var reportDatas = new ConcurrentBag<ReportModel>();
|
||||||
//foreach (var entry in data)
|
//foreach (var entry in data)
|
||||||
data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>
|
data.Where(it =>
|
||||||
|
it.OrigOcc == "OccWire"
|
||||||
|
&& !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)
|
||||||
|
)
|
||||||
|
.AsParallel()
|
||||||
|
.WithDegreeOfParallelism(8)
|
||||||
|
.ForAll(entry =>
|
||||||
{
|
{
|
||||||
var obj = new ReportModel();
|
var obj = new ReportModel();
|
||||||
foreach (var column in columns)
|
foreach (var column in columns)
|
||||||
|
|
Loading…
Reference in New Issue