但是,在将PCL项目转换为.NET Standard 1.3 lib后,它失败了:
error CS1061: 'IEnumerable<string>' does not contain a definition for 'AsParallel' and no extension method 'AsParallel' accepting a first argument of type 'IEnumerable<string>' could be found (are you missing a using directive or an assembly reference?)
但是.NET Standard 1.3仍然应该支持PLINQ的AsParallel()方法,对吗? 也许我忽略了什么?是否应该为PLINQ包含额外的nuget?
using System.Collections.Generic;
using System.Linq;
namespace PclTest
{
public class Class1
{
public void Test()
{
List<string> list = new List<string> { "foo", "bar" };
var result = list.AsParallel().Where(x => x == "foo").ToList();
System.Diagnostics.Debug.Assert(result.Count == 1);
}
}
}
我正在使用带有所有最新更新的Visual Studio 2015