public void Parallel() { var urls = FSharpList.Create( "http://www.google.com" , "http://www.bing.com" , "http://www.yahoo.com" , "http://www.microsoft.com" ); var result = FSharpAsync.Parallel(urls.Select(Get)).Select(s => string.Join("", s)).Run(); var rx = new Regex(@"<html"); Assert.AreEqual(4, rx.Matches(result).Count); }
public static Task <R[]> Parallel <R>(IEnumerable <Task <R> > computations) => FSharpAsync.StartAsTask(FSharpAsync.Parallel <R>(computations.Select(FSharpAsync.AwaitTask)), FSharpOption <TaskCreationOptions> .None, FSharpOption <System.Threading.CancellationToken> .None);
public static FSharpAsync <R[]> Parallel <R>(IEnumerable <FSharpAsync <R> > computations) => FSharpAsync.Parallel <R>(computations);