Reputation: 315
the bit of code below does compile fine when sitting within a PCL lib with profile7 (targets: .NET 4.5, Windows 8, .NET Core 1.0, Xamarin.Android, Xamarin.IOS, Xamarin.IOS Classic)
However, after converting the PCL project to a .NET Standard 1.3 lib it fails with:
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?)
But .NET Standard 1.3 should still support PLINQ's AsParallel() method, right? Perhaps I'm overlooking something? Should there perhaps be an an additional nuget included for PLINQ?
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);
}
}
}
I am using Visual Studio 2015 with all the latest updates
Upvotes: 3
Views: 969
Reputation: 18799
There is a Nuget package called System.Linq.Parallel which provides the AsParallel
method in PCL
's
Upvotes: 1