[英]Use KeyValuePair<String, String> in Parallel.ForEach
I want to run this normal loop in Parallel using Parallel.For or Parallel.ForEach<>
我想使用Parallel.For或
Parallel.ForEach<>
在Parallel中运行此常规循环
foreach (KeyValuePair<String, String> symbol in symbolsConfigured){..}
I've been using elsewhere like this - 我一直在这样的其他地方使用-
Parallel.ForEach(sig.Products, dbp =>
{...}
But I can't think of how to write this. 但我想不出该如何写。
You do it exactly the same way: 您可以完全相同地执行此操作:
Parallel.ForEach(symbolsConfigured, kvp =>
{...});
The compiler will infer the callback's parameter type, just like any other call. 像其他任何调用一样,编译器将推断回调的参数类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.