Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个大列表
List<long> longList = new List<long>(10000000)
我想做以下查询:
bool found = longList.Contains(4345235234524245124L);
有没有办法使用 PLinq 让每个线程只搜索列表的一小部分?
我知道在这种情况下使用 Dictionary 或 HashMap 会更好。这只是我想知道的关于 PLinq 的事情,这个例子非常方便。
是的,使用
bool found = longList.AsParallel().Contains(4345235234524245124L);
确实应该并行化它。