Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -0,0 +1,36 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Linq.Parallel.Tests", "tests\System.Linq.Parallel.Tests.csproj", "{A7074928-82C3-4739-88FE-9B528977950C}"
ProjectSection(ProjectDependencies) = postProject
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD} = {BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Linq.Parallel", "src\System.Linq.Parallel.csproj", "{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{47919FF5-DA40-4D99-AF2D-F560282AA913}"
ProjectSection(SolutionItems) = preProject
..\.nuget\packages.Windows_NT.config = ..\.nuget\packages.Windows_NT.config
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU
ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A7074928-82C3-4739-88FE-9B528977950C}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{A7074928-82C3-4739-88FE-9B528977950C}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{A7074928-82C3-4739-88FE-9B528977950C}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{A7074928-82C3-4739-88FE-9B528977950C}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<IsNETCoreApp>true</IsNETCoreApp>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netcoreapp;
uap;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,258 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ------------------------------------------------------------------------------
// Changes to this file must follow the http://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace System.Linq
{
public partial class OrderedParallelQuery<TSource> : System.Linq.ParallelQuery<TSource>
{
internal OrderedParallelQuery() { }
public override System.Collections.Generic.IEnumerator<TSource> GetEnumerator() { throw null; }
}
public static partial class ParallelEnumerable
{
public static TSource Aggregate<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TSource, TSource> func) { throw null; }
public static TAccumulate Aggregate<TSource, TAccumulate>(this System.Linq.ParallelQuery<TSource> source, TAccumulate seed, System.Func<TAccumulate, TSource, TAccumulate> func) { throw null; }
public static TResult Aggregate<TSource, TAccumulate, TResult>(this System.Linq.ParallelQuery<TSource> source, TAccumulate seed, System.Func<TAccumulate, TSource, TAccumulate> updateAccumulatorFunc, System.Func<TAccumulate, TAccumulate, TAccumulate> combineAccumulatorsFunc, System.Func<TAccumulate, TResult> resultSelector) { throw null; }
public static TResult Aggregate<TSource, TAccumulate, TResult>(this System.Linq.ParallelQuery<TSource> source, TAccumulate seed, System.Func<TAccumulate, TSource, TAccumulate> func, System.Func<TAccumulate, TResult> resultSelector) { throw null; }
public static TResult Aggregate<TSource, TAccumulate, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TAccumulate> seedFactory, System.Func<TAccumulate, TSource, TAccumulate> updateAccumulatorFunc, System.Func<TAccumulate, TAccumulate, TAccumulate> combineAccumulatorsFunc, System.Func<TAccumulate, TResult> resultSelector) { throw null; }
public static bool All<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static bool Any<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static bool Any<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static System.Collections.Generic.IEnumerable<TSource> AsEnumerable<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static System.Linq.ParallelQuery AsOrdered(this System.Linq.ParallelQuery source) { throw null; }
public static System.Linq.ParallelQuery<TSource> AsOrdered<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static System.Linq.ParallelQuery AsParallel(this System.Collections.IEnumerable source) { throw null; }
public static System.Linq.ParallelQuery<TSource> AsParallel<TSource>(this System.Collections.Concurrent.Partitioner<TSource> source) { throw null; }
public static System.Linq.ParallelQuery<TSource> AsParallel<TSource>(this System.Collections.Generic.IEnumerable<TSource> source) { throw null; }
public static System.Collections.Generic.IEnumerable<TSource> AsSequential<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static System.Linq.ParallelQuery<TSource> AsUnordered<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static decimal Average(this System.Linq.ParallelQuery<decimal> source) { throw null; }
public static double Average(this System.Linq.ParallelQuery<double> source) { throw null; }
public static double Average(this System.Linq.ParallelQuery<int> source) { throw null; }
public static double Average(this System.Linq.ParallelQuery<long> source) { throw null; }
public static System.Nullable<decimal> Average(this System.Linq.ParallelQuery<System.Nullable<decimal>> source) { throw null; }
public static System.Nullable<double> Average(this System.Linq.ParallelQuery<System.Nullable<double>> source) { throw null; }
public static System.Nullable<double> Average(this System.Linq.ParallelQuery<System.Nullable<int>> source) { throw null; }
public static System.Nullable<double> Average(this System.Linq.ParallelQuery<System.Nullable<long>> source) { throw null; }
public static System.Nullable<float> Average(this System.Linq.ParallelQuery<System.Nullable<float>> source) { throw null; }
public static float Average(this System.Linq.ParallelQuery<float> source) { throw null; }
public static decimal Average<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, decimal> selector) { throw null; }
public static double Average<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, double> selector) { throw null; }
public static double Average<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, int> selector) { throw null; }
public static double Average<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, long> selector) { throw null; }
public static System.Nullable<decimal> Average<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<decimal>> selector) { throw null; }
public static System.Nullable<double> Average<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<double>> selector) { throw null; }
public static System.Nullable<double> Average<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<int>> selector) { throw null; }
public static System.Nullable<double> Average<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<long>> selector) { throw null; }
public static System.Nullable<float> Average<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<float>> selector) { throw null; }
public static float Average<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, float> selector) { throw null; }
public static System.Linq.ParallelQuery<TResult> Cast<TResult>(this System.Linq.ParallelQuery source) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TSource> Concat<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Collections.Generic.IEnumerable<TSource> second) { throw null; }
public static System.Linq.ParallelQuery<TSource> Concat<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Linq.ParallelQuery<TSource> second) { throw null; }
public static bool Contains<TSource>(this System.Linq.ParallelQuery<TSource> source, TSource value) { throw null; }
public static bool Contains<TSource>(this System.Linq.ParallelQuery<TSource> source, TSource value, System.Collections.Generic.IEqualityComparer<TSource> comparer) { throw null; }
public static int Count<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static int Count<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static System.Linq.ParallelQuery<TSource> DefaultIfEmpty<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static System.Linq.ParallelQuery<TSource> DefaultIfEmpty<TSource>(this System.Linq.ParallelQuery<TSource> source, TSource defaultValue) { throw null; }
public static System.Linq.ParallelQuery<TSource> Distinct<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static System.Linq.ParallelQuery<TSource> Distinct<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Collections.Generic.IEqualityComparer<TSource> comparer) { throw null; }
public static TSource ElementAt<TSource>(this System.Linq.ParallelQuery<TSource> source, int index) { throw null; }
public static TSource ElementAtOrDefault<TSource>(this System.Linq.ParallelQuery<TSource> source, int index) { throw null; }
public static System.Linq.ParallelQuery<TResult> Empty<TResult>() { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TSource> Except<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Collections.Generic.IEnumerable<TSource> second) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TSource> Except<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Collections.Generic.IEnumerable<TSource> second, System.Collections.Generic.IEqualityComparer<TSource> comparer) { throw null; }
public static System.Linq.ParallelQuery<TSource> Except<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Linq.ParallelQuery<TSource> second) { throw null; }
public static System.Linq.ParallelQuery<TSource> Except<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Linq.ParallelQuery<TSource> second, System.Collections.Generic.IEqualityComparer<TSource> comparer) { throw null; }
public static TSource First<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static TSource First<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static TSource FirstOrDefault<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static TSource FirstOrDefault<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static void ForAll<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Action<TSource> action) { }
public static System.Linq.ParallelQuery<System.Linq.IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector) { throw null; }
public static System.Linq.ParallelQuery<System.Linq.IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { throw null; }
public static System.Linq.ParallelQuery<System.Linq.IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Func<TSource, TElement> elementSelector) { throw null; }
public static System.Linq.ParallelQuery<System.Linq.IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Func<TSource, TElement> elementSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { throw null; }
public static System.Linq.ParallelQuery<TResult> GroupBy<TSource, TKey, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Func<TKey, System.Collections.Generic.IEnumerable<TSource>, TResult> resultSelector) { throw null; }
public static System.Linq.ParallelQuery<TResult> GroupBy<TSource, TKey, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Func<TKey, System.Collections.Generic.IEnumerable<TSource>, TResult> resultSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { throw null; }
public static System.Linq.ParallelQuery<TResult> GroupBy<TSource, TKey, TElement, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Func<TSource, TElement> elementSelector, System.Func<TKey, System.Collections.Generic.IEnumerable<TElement>, TResult> resultSelector) { throw null; }
public static System.Linq.ParallelQuery<TResult> GroupBy<TSource, TKey, TElement, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Func<TSource, TElement> elementSelector, System.Func<TKey, System.Collections.Generic.IEnumerable<TElement>, TResult> resultSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this System.Linq.ParallelQuery<TOuter> outer, System.Collections.Generic.IEnumerable<TInner> inner, System.Func<TOuter, TKey> outerKeySelector, System.Func<TInner, TKey> innerKeySelector, System.Func<TOuter, System.Collections.Generic.IEnumerable<TInner>, TResult> resultSelector) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this System.Linq.ParallelQuery<TOuter> outer, System.Collections.Generic.IEnumerable<TInner> inner, System.Func<TOuter, TKey> outerKeySelector, System.Func<TInner, TKey> innerKeySelector, System.Func<TOuter, System.Collections.Generic.IEnumerable<TInner>, TResult> resultSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { throw null; }
public static System.Linq.ParallelQuery<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this System.Linq.ParallelQuery<TOuter> outer, System.Linq.ParallelQuery<TInner> inner, System.Func<TOuter, TKey> outerKeySelector, System.Func<TInner, TKey> innerKeySelector, System.Func<TOuter, System.Collections.Generic.IEnumerable<TInner>, TResult> resultSelector) { throw null; }
public static System.Linq.ParallelQuery<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this System.Linq.ParallelQuery<TOuter> outer, System.Linq.ParallelQuery<TInner> inner, System.Func<TOuter, TKey> outerKeySelector, System.Func<TInner, TKey> innerKeySelector, System.Func<TOuter, System.Collections.Generic.IEnumerable<TInner>, TResult> resultSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TSource> Intersect<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Collections.Generic.IEnumerable<TSource> second) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TSource> Intersect<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Collections.Generic.IEnumerable<TSource> second, System.Collections.Generic.IEqualityComparer<TSource> comparer) { throw null; }
public static System.Linq.ParallelQuery<TSource> Intersect<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Linq.ParallelQuery<TSource> second) { throw null; }
public static System.Linq.ParallelQuery<TSource> Intersect<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Linq.ParallelQuery<TSource> second, System.Collections.Generic.IEqualityComparer<TSource> comparer) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TResult> Join<TOuter, TInner, TKey, TResult>(this System.Linq.ParallelQuery<TOuter> outer, System.Collections.Generic.IEnumerable<TInner> inner, System.Func<TOuter, TKey> outerKeySelector, System.Func<TInner, TKey> innerKeySelector, System.Func<TOuter, TInner, TResult> resultSelector) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TResult> Join<TOuter, TInner, TKey, TResult>(this System.Linq.ParallelQuery<TOuter> outer, System.Collections.Generic.IEnumerable<TInner> inner, System.Func<TOuter, TKey> outerKeySelector, System.Func<TInner, TKey> innerKeySelector, System.Func<TOuter, TInner, TResult> resultSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { throw null; }
public static System.Linq.ParallelQuery<TResult> Join<TOuter, TInner, TKey, TResult>(this System.Linq.ParallelQuery<TOuter> outer, System.Linq.ParallelQuery<TInner> inner, System.Func<TOuter, TKey> outerKeySelector, System.Func<TInner, TKey> innerKeySelector, System.Func<TOuter, TInner, TResult> resultSelector) { throw null; }
public static System.Linq.ParallelQuery<TResult> Join<TOuter, TInner, TKey, TResult>(this System.Linq.ParallelQuery<TOuter> outer, System.Linq.ParallelQuery<TInner> inner, System.Func<TOuter, TKey> outerKeySelector, System.Func<TInner, TKey> innerKeySelector, System.Func<TOuter, TInner, TResult> resultSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { throw null; }
public static TSource Last<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static TSource Last<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static TSource LastOrDefault<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static TSource LastOrDefault<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static long LongCount<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static long LongCount<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static decimal Max(this System.Linq.ParallelQuery<decimal> source) { throw null; }
public static double Max(this System.Linq.ParallelQuery<double> source) { throw null; }
public static int Max(this System.Linq.ParallelQuery<int> source) { throw null; }
public static long Max(this System.Linq.ParallelQuery<long> source) { throw null; }
public static System.Nullable<decimal> Max(this System.Linq.ParallelQuery<System.Nullable<decimal>> source) { throw null; }
public static System.Nullable<double> Max(this System.Linq.ParallelQuery<System.Nullable<double>> source) { throw null; }
public static System.Nullable<int> Max(this System.Linq.ParallelQuery<System.Nullable<int>> source) { throw null; }
public static System.Nullable<long> Max(this System.Linq.ParallelQuery<System.Nullable<long>> source) { throw null; }
public static System.Nullable<float> Max(this System.Linq.ParallelQuery<System.Nullable<float>> source) { throw null; }
public static float Max(this System.Linq.ParallelQuery<float> source) { throw null; }
public static TSource Max<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static decimal Max<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, decimal> selector) { throw null; }
public static double Max<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, double> selector) { throw null; }
public static int Max<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, int> selector) { throw null; }
public static long Max<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, long> selector) { throw null; }
public static System.Nullable<decimal> Max<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<decimal>> selector) { throw null; }
public static System.Nullable<double> Max<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<double>> selector) { throw null; }
public static System.Nullable<int> Max<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<int>> selector) { throw null; }
public static System.Nullable<long> Max<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<long>> selector) { throw null; }
public static System.Nullable<float> Max<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<float>> selector) { throw null; }
public static float Max<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, float> selector) { throw null; }
public static TResult Max<TSource, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TResult> selector) { throw null; }
public static decimal Min(this System.Linq.ParallelQuery<decimal> source) { throw null; }
public static double Min(this System.Linq.ParallelQuery<double> source) { throw null; }
public static int Min(this System.Linq.ParallelQuery<int> source) { throw null; }
public static long Min(this System.Linq.ParallelQuery<long> source) { throw null; }
public static System.Nullable<decimal> Min(this System.Linq.ParallelQuery<System.Nullable<decimal>> source) { throw null; }
public static System.Nullable<double> Min(this System.Linq.ParallelQuery<System.Nullable<double>> source) { throw null; }
public static System.Nullable<int> Min(this System.Linq.ParallelQuery<System.Nullable<int>> source) { throw null; }
public static System.Nullable<long> Min(this System.Linq.ParallelQuery<System.Nullable<long>> source) { throw null; }
public static System.Nullable<float> Min(this System.Linq.ParallelQuery<System.Nullable<float>> source) { throw null; }
public static float Min(this System.Linq.ParallelQuery<float> source) { throw null; }
public static TSource Min<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static decimal Min<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, decimal> selector) { throw null; }
public static double Min<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, double> selector) { throw null; }
public static int Min<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, int> selector) { throw null; }
public static long Min<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, long> selector) { throw null; }
public static System.Nullable<decimal> Min<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<decimal>> selector) { throw null; }
public static System.Nullable<double> Min<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<double>> selector) { throw null; }
public static System.Nullable<int> Min<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<int>> selector) { throw null; }
public static System.Nullable<long> Min<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<long>> selector) { throw null; }
public static System.Nullable<float> Min<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<float>> selector) { throw null; }
public static float Min<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, float> selector) { throw null; }
public static TResult Min<TSource, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TResult> selector) { throw null; }
public static System.Linq.ParallelQuery<TResult> OfType<TResult>(this System.Linq.ParallelQuery source) { throw null; }
public static System.Linq.OrderedParallelQuery<TSource> OrderBy<TSource, TKey>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector) { throw null; }
public static System.Linq.OrderedParallelQuery<TSource> OrderBy<TSource, TKey>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Collections.Generic.IComparer<TKey> comparer) { throw null; }
public static System.Linq.OrderedParallelQuery<TSource> OrderByDescending<TSource, TKey>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector) { throw null; }
public static System.Linq.OrderedParallelQuery<TSource> OrderByDescending<TSource, TKey>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Collections.Generic.IComparer<TKey> comparer) { throw null; }
public static System.Linq.ParallelQuery<int> Range(int start, int count) { throw null; }
public static System.Linq.ParallelQuery<TResult> Repeat<TResult>(TResult element, int count) { throw null; }
public static System.Linq.ParallelQuery<TSource> Reverse<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static System.Linq.ParallelQuery<TResult> Select<TSource, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TResult> selector) { throw null; }
public static System.Linq.ParallelQuery<TResult> Select<TSource, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, int, TResult> selector) { throw null; }
public static System.Linq.ParallelQuery<TResult> SelectMany<TSource, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Collections.Generic.IEnumerable<TResult>> selector) { throw null; }
public static System.Linq.ParallelQuery<TResult> SelectMany<TSource, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, int, System.Collections.Generic.IEnumerable<TResult>> selector) { throw null; }
public static System.Linq.ParallelQuery<TResult> SelectMany<TSource, TCollection, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Collections.Generic.IEnumerable<TCollection>> collectionSelector, System.Func<TSource, TCollection, TResult> resultSelector) { throw null; }
public static System.Linq.ParallelQuery<TResult> SelectMany<TSource, TCollection, TResult>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, int, System.Collections.Generic.IEnumerable<TCollection>> collectionSelector, System.Func<TSource, TCollection, TResult> resultSelector) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static bool SequenceEqual<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Collections.Generic.IEnumerable<TSource> second) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static bool SequenceEqual<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Collections.Generic.IEnumerable<TSource> second, System.Collections.Generic.IEqualityComparer<TSource> comparer) { throw null; }
public static bool SequenceEqual<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Linq.ParallelQuery<TSource> second) { throw null; }
public static bool SequenceEqual<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Linq.ParallelQuery<TSource> second, System.Collections.Generic.IEqualityComparer<TSource> comparer) { throw null; }
public static TSource Single<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static TSource Single<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static TSource SingleOrDefault<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static TSource SingleOrDefault<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static System.Linq.ParallelQuery<TSource> Skip<TSource>(this System.Linq.ParallelQuery<TSource> source, int count) { throw null; }
public static System.Linq.ParallelQuery<TSource> SkipWhile<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static System.Linq.ParallelQuery<TSource> SkipWhile<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, int, bool> predicate) { throw null; }
public static decimal Sum(this System.Linq.ParallelQuery<decimal> source) { throw null; }
public static double Sum(this System.Linq.ParallelQuery<double> source) { throw null; }
public static int Sum(this System.Linq.ParallelQuery<int> source) { throw null; }
public static long Sum(this System.Linq.ParallelQuery<long> source) { throw null; }
public static System.Nullable<decimal> Sum(this System.Linq.ParallelQuery<System.Nullable<decimal>> source) { throw null; }
public static System.Nullable<double> Sum(this System.Linq.ParallelQuery<System.Nullable<double>> source) { throw null; }
public static System.Nullable<int> Sum(this System.Linq.ParallelQuery<System.Nullable<int>> source) { throw null; }
public static System.Nullable<long> Sum(this System.Linq.ParallelQuery<System.Nullable<long>> source) { throw null; }
public static System.Nullable<float> Sum(this System.Linq.ParallelQuery<System.Nullable<float>> source) { throw null; }
public static float Sum(this System.Linq.ParallelQuery<float> source) { throw null; }
public static decimal Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, decimal> selector) { throw null; }
public static double Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, double> selector) { throw null; }
public static int Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, int> selector) { throw null; }
public static long Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, long> selector) { throw null; }
public static System.Nullable<decimal> Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<decimal>> selector) { throw null; }
public static System.Nullable<double> Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<double>> selector) { throw null; }
public static System.Nullable<int> Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<int>> selector) { throw null; }
public static System.Nullable<long> Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<long>> selector) { throw null; }
public static System.Nullable<float> Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, System.Nullable<float>> selector) { throw null; }
public static float Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, float> selector) { throw null; }
public static System.Linq.ParallelQuery<TSource> Take<TSource>(this System.Linq.ParallelQuery<TSource> source, int count) { throw null; }
public static System.Linq.ParallelQuery<TSource> TakeWhile<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static System.Linq.ParallelQuery<TSource> TakeWhile<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, int, bool> predicate) { throw null; }
public static System.Linq.OrderedParallelQuery<TSource> ThenBy<TSource, TKey>(this System.Linq.OrderedParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector) { throw null; }
public static System.Linq.OrderedParallelQuery<TSource> ThenBy<TSource, TKey>(this System.Linq.OrderedParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Collections.Generic.IComparer<TKey> comparer) { throw null; }
public static System.Linq.OrderedParallelQuery<TSource> ThenByDescending<TSource, TKey>(this System.Linq.OrderedParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector) { throw null; }
public static System.Linq.OrderedParallelQuery<TSource> ThenByDescending<TSource, TKey>(this System.Linq.OrderedParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Collections.Generic.IComparer<TKey> comparer) { throw null; }
public static TSource[] ToArray<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static System.Collections.Generic.Dictionary<TKey, TSource> ToDictionary<TSource, TKey>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector) { throw null; }
public static System.Collections.Generic.Dictionary<TKey, TSource> ToDictionary<TSource, TKey>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { throw null; }
public static System.Collections.Generic.Dictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Func<TSource, TElement> elementSelector) { throw null; }
public static System.Collections.Generic.Dictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Func<TSource, TElement> elementSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { throw null; }
public static System.Collections.Generic.List<TSource> ToList<TSource>(this System.Linq.ParallelQuery<TSource> source) { throw null; }
public static System.Linq.ILookup<TKey, TSource> ToLookup<TSource, TKey>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector) { throw null; }
public static System.Linq.ILookup<TKey, TSource> ToLookup<TSource, TKey>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { throw null; }
public static System.Linq.ILookup<TKey, TElement> ToLookup<TSource, TKey, TElement>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Func<TSource, TElement> elementSelector) { throw null; }
public static System.Linq.ILookup<TKey, TElement> ToLookup<TSource, TKey, TElement>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, TKey> keySelector, System.Func<TSource, TElement> elementSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TSource> Union<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Collections.Generic.IEnumerable<TSource> second) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TSource> Union<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Collections.Generic.IEnumerable<TSource> second, System.Collections.Generic.IEqualityComparer<TSource> comparer) { throw null; }
public static System.Linq.ParallelQuery<TSource> Union<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Linq.ParallelQuery<TSource> second) { throw null; }
public static System.Linq.ParallelQuery<TSource> Union<TSource>(this System.Linq.ParallelQuery<TSource> first, System.Linq.ParallelQuery<TSource> second, System.Collections.Generic.IEqualityComparer<TSource> comparer) { throw null; }
public static System.Linq.ParallelQuery<TSource> Where<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, bool> predicate) { throw null; }
public static System.Linq.ParallelQuery<TSource> Where<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Func<TSource, int, bool> predicate) { throw null; }
public static System.Linq.ParallelQuery<TSource> WithCancellation<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Linq.ParallelQuery<TSource> WithDegreeOfParallelism<TSource>(this System.Linq.ParallelQuery<TSource> source, int degreeOfParallelism) { throw null; }
public static System.Linq.ParallelQuery<TSource> WithExecutionMode<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Linq.ParallelExecutionMode executionMode) { throw null; }
public static System.Linq.ParallelQuery<TSource> WithMergeOptions<TSource>(this System.Linq.ParallelQuery<TSource> source, System.Linq.ParallelMergeOptions mergeOptions) { throw null; }
[System.ObsoleteAttribute("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TResult> Zip<TFirst, TSecond, TResult>(this System.Linq.ParallelQuery<TFirst> first, System.Collections.Generic.IEnumerable<TSecond> second, System.Func<TFirst, TSecond, TResult> resultSelector) { throw null; }
public static System.Linq.ParallelQuery<TResult> Zip<TFirst, TSecond, TResult>(this System.Linq.ParallelQuery<TFirst> first, System.Linq.ParallelQuery<TSecond> second, System.Func<TFirst, TSecond, TResult> resultSelector) { throw null; }
}
public enum ParallelExecutionMode
{
Default = 0,
ForceParallelism = 1,
}
public enum ParallelMergeOptions
{
AutoBuffered = 2,
Default = 0,
FullyBuffered = 3,
NotBuffered = 1,
}
public partial class ParallelQuery : System.Collections.IEnumerable
{
internal ParallelQuery() { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public partial class ParallelQuery<TSource> : System.Linq.ParallelQuery, System.Collections.Generic.IEnumerable<TSource>, System.Collections.IEnumerable
{
internal ParallelQuery() { }
public virtual System.Collections.Generic.IEnumerator<TSource> GetEnumerator() { throw null; }
}
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="System.Linq.Parallel.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.Collections.Concurrent\ref\System.Collections.Concurrent.csproj" />
<ProjectReference Include="..\..\System.Linq\ref\System.Linq.csproj" />
<ProjectReference Include="..\..\System.Collections\ref\System.Collections.csproj" />
<ProjectReference Include="..\..\System.Threading.Tasks\ref\System.Threading.Tasks.csproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netcoreapp;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="MoreThanOneElement" xml:space="preserve">
<value>Sequence contains more than one element</value>
</data>
<data name="MoreThanOneMatch" xml:space="preserve">
<value>Sequence contains more than one matching element</value>
</data>
<data name="NoElements" xml:space="preserve">
<value>Sequence contains no elements</value>
</data>
<data name="NoMatch" xml:space="preserve">
<value>Sequence contains no matching element</value>
</data>
<data name="ParallelPartitionable_NullReturn" xml:space="preserve">
<value>The return value must not be null.</value>
</data>
<data name="ParallelPartitionable_IncorretElementCount" xml:space="preserve">
<value>The returned array's length must equal the number of partitions requested.</value>
</data>
<data name="ParallelPartitionable_NullElement" xml:space="preserve">
<value>Elements returned must not be null.</value>
</data>
<data name="PLINQ_CommonEnumerator_Current_NotStarted" xml:space="preserve">
<value>Enumeration has not started. MoveNext must be called to initiate enumeration.</value>
</data>
<data name="PLINQ_ExternalCancellationRequested" xml:space="preserve">
<value>The query has been canceled via the token supplied to WithCancellation.</value>
</data>
<data name="PLINQ_DisposeRequested" xml:space="preserve">
<value>The query enumerator has been disposed.</value>
</data>
<data name="ParallelQuery_DuplicateTaskScheduler" xml:space="preserve">
<value>The WithTaskScheduler operator may be used at most once in a query.</value>
</data>
<data name="ParallelQuery_DuplicateDOP" xml:space="preserve">
<value>The WithDegreeOfParallelism operator may be used at most once in a query.</value>
</data>
<data name="ParallelQuery_DuplicateExecutionMode" xml:space="preserve">
<value>The WithExecutionMode operator may be used at most once in a query.</value>
</data>
<data name="PartitionerQueryOperator_NullPartitionList" xml:space="preserve">
<value>Partitioner returned null instead of a list of partitions.</value>
</data>
<data name="PartitionerQueryOperator_WrongNumberOfPartitions" xml:space="preserve">
<value>Partitioner returned a wrong number of partitions.</value>
</data>
<data name="PartitionerQueryOperator_NullPartition" xml:space="preserve">
<value>Partitioner returned a null partition.</value>
</data>
<data name="ParallelQuery_DuplicateWithCancellation" xml:space="preserve">
<value>The WithCancellation operator may by used at most once in a query.</value>
</data>
<data name="ParallelQuery_DuplicateMergeOptions" xml:space="preserve">
<value>The WithMergeOptions operator may be used at most once in a query.</value>
</data>
<data name="PLINQ_EnumerationPreviouslyFailed" xml:space="preserve">
<value>The query enumerator previously threw an exception.</value>
</data>
<data name="ParallelQuery_PartitionerNotOrderable" xml:space="preserve">
<value>AsOrdered may not be used with a partitioner that is not orderable.</value>
</data>
<data name="ParallelQuery_InvalidAsOrderedCall" xml:space="preserve">
<value>AsOrdered may only be called on the result of AsParallel, ParallelEnumerable.Range, or ParallelEnumerable.Repeat.</value>
</data>
<data name="ParallelQuery_InvalidNonGenericAsOrderedCall" xml:space="preserve">
<value>Non-generic AsOrdered may only be called on the result of the non-generic AsParallel.</value>
</data>
<data name="ParallelEnumerable_BinaryOpMustUseAsParallel" xml:space="preserve">
<value>The second data source of a binary operator must be of type System.Linq.ParallelQuery&lt;T&gt; rather than System.Collections.Generic.IEnumerable&lt;T&gt;. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery&lt;T&gt;.</value>
</data>
<data name="ParallelEnumerable_WithQueryExecutionMode_InvalidMode" xml:space="preserve">
<value>The executionMode argument contains an invalid value.</value>
</data>
<data name="ParallelEnumerable_WithMergeOptions_InvalidOptions" xml:space="preserve">
<value>The mergeOptions argument contains an invalid value.</value>
</data>
</root>

View File

@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}</ProjectGuid>
<AssemblyName>System.Linq.Parallel</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Release|AnyCPU'" />
<!-- Compiled Source Files -->
<ItemGroup>
<Compile Include="System\Linq\Parallel\Channels\AsynchronousChannel.cs" />
<Compile Include="System\Linq\Parallel\Channels\SynchronousChannel.cs" />
<Compile Include="System\Linq\Parallel\Enumerables\AggregationMinMaxHelpers.cs" />
<Compile Include="System\Linq\Parallel\Enumerables\EmptyEnumerable.cs" />
<Compile Include="System\Linq\Parallel\Enumerables\EnumerableWrapperWeakToStrong.cs" />
<Compile Include="System\Linq\Parallel\Enumerables\IParallelPartitionable.cs" />
<Compile Include="System\Linq\Parallel\Enumerables\OrderedParallelQuery.cs" />
<Compile Include="System\Linq\Parallel\Enumerables\ParallelEnumerableWrapper.cs" />
<Compile Include="System\Linq\Parallel\Enumerables\ParallelQuery.cs" />
<Compile Include="System\Linq\Parallel\Enumerables\QueryAggregationOptions.cs" />
<Compile Include="System\Linq\Parallel\Enumerables\RangeEnumerable.cs" />
<Compile Include="System\Linq\Parallel\Enumerables\RepeatEnumerable.cs" />
<Compile Include="System\Linq\Parallel\Merging\ArrayMergeHelper.cs" />
<Compile Include="System\Linq\Parallel\Merging\AsynchronousChannelMergeEnumerator.cs" />
<Compile Include="System\Linq\Parallel\Merging\DefaultMergeHelper.cs" />
<Compile Include="System\Linq\Parallel\Merging\IMergeHelper.cs" />
<Compile Include="System\Linq\Parallel\Merging\MergeEnumerator.cs" />
<Compile Include="System\Linq\Parallel\Merging\MergeExecutor.cs" />
<Compile Include="System\Linq\Parallel\Merging\OrderPreservingMergeHelper.cs" />
<Compile Include="System\Linq\Parallel\Merging\OrderPreservingPipeliningMergeHelper.cs" />
<Compile Include="System\Linq\Parallel\Merging\SynchronousChannelMergeEnumerator.cs" />
<Compile Include="System\Linq\ParallelEnumerable.cs" />
<Compile Include="System\Linq\ParallelExecutionMode.cs" />
<Compile Include="System\Linq\ParallelMergeOptions.cs" />
<Compile Include="System\Linq\Parallel\Partitioning\HashRepartitionEnumerator.cs" />
<Compile Include="System\Linq\Parallel\Partitioning\HashRepartitionStream.cs" />
<Compile Include="System\Linq\Parallel\Partitioning\IPartitionedStreamRecipient.cs" />
<Compile Include="System\Linq\Parallel\Partitioning\OrderedHashRepartitionEnumerator.cs" />
<Compile Include="System\Linq\Parallel\Partitioning\OrderedHashRepartitionStream.cs" />
<Compile Include="System\Linq\Parallel\Partitioning\PartitionedDataSource.cs" />
<Compile Include="System\Linq\Parallel\Partitioning\PartitionedStream.cs" />
<Compile Include="System\Linq\Parallel\Partitioning\UnorderedHashRepartitionStream.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\AssociativeAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\BinaryQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Binary\ConcatQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Binary\ExceptQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Binary\GroupJoinQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Binary\HashJoinQueryOperatorEnumerator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Binary\IntersectQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Binary\JoinQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Binary\UnionQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Binary\ZipQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\CountAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\DecimalAverageAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\DecimalMinMaxAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\DecimalSumAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\DoubleAverageAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\DoubleMinMaxAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\DoubleSumAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\FloatAverageAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\FloatMinMaxAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\FloatSumAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\InlinedAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\InlinedAggregationOperatorEnumerator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\IntAverageAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\IntMinMaxAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\IntSumAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\LongAverageAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\LongCountAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\LongMinMaxAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\LongSumAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableDecimalAverageAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableDecimalMinMaxAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableDecimalSumAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableDoubleAverageAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableDoubleMinMaxAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableDoubleSumAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableFloatAverageAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableFloatMinMaxAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableFloatSumAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableIntAverageAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableIntMinMaxAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableIntSumAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableLongAverageAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableLongMinMaxAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Inlined\NullableLongSumAggregationOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\ListQueryResults.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Options\OrderingQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Options\QueryExecutionOption.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\OrdinalIndexState.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\PartitionedStreamMerger.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\PartitionerQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\QueryOpeningEnumerator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\QueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\QueryOperatorEnumerator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\QueryResults.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\QuerySettings.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\ScanQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\UnaryQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\AnyAllSearchOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\ContainsSearchOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\DefaultIfEmptyQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\DistinctQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\ElementAtQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\FirstQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\ForAllOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\GroupByQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\IndexedSelectQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\IndexedWhereQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\LastQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\ReverseQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\SelectManyQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\SelectQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\SingleQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\SortQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\TakeOrSkipQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\TakeOrSkipWhileQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\QueryOperators\Unary\WhereQueryOperator.cs" />
<Compile Include="System\Linq\Parallel\Scheduling\CancellationState.cs" />
<Compile Include="System\Linq\Parallel\Scheduling\OrderPreservingPipeliningSpoolingTask.cs" />
<Compile Include="System\Linq\Parallel\Scheduling\OrderPreservingSpoolingTask.cs" />
<Compile Include="System\Linq\Parallel\Scheduling\QueryLifecycle.cs" />
<Compile Include="System\Linq\Parallel\Scheduling\QueryTask.cs" />
<Compile Include="System\Linq\Parallel\Scheduling\QueryTaskGroupState.cs" />
<Compile Include="System\Linq\Parallel\Scheduling\Scheduling.cs" />
<Compile Include="System\Linq\Parallel\Scheduling\SpoolingTask.cs" />
<Compile Include="System\Linq\Parallel\Scheduling\SpoolingTaskBase.cs" />
<Compile Include="System\Linq\Parallel\Helpers.cs" />
<Compile Include="System\Linq\Parallel\Utils\CancellableEnumerable.cs" />
<Compile Include="System\Linq\Parallel\Utils\ExceptionAggregator.cs" />
<Compile Include="System\Linq\Parallel\Utils\ExchangeUtilities.cs" />
<Compile Include="System\Linq\Parallel\Utils\FixedMaxHeap.cs" />
<Compile Include="System\Linq\Parallel\Utils\GrowingArray.cs" />
<Compile Include="System\Linq\Parallel\Utils\HashLookup.cs" />
<Compile Include="System\Linq\Parallel\Utils\IntValueEvent.cs" />
<Compile Include="System\Linq\Parallel\Utils\ListChunk.cs" />
<Compile Include="System\Linq\Parallel\Utils\Lookup.cs" />
<Compile Include="System\Linq\Parallel\Utils\Pair.cs" />
<Compile Include="System\Linq\Parallel\Utils\PairComparer.cs" />
<Compile Include="System\Linq\Parallel\Utils\PLINQETWProvider.cs" />
<Compile Include="System\Linq\Parallel\Utils\ReverseComparer.cs" />
<Compile Include="System\Linq\Parallel\Utils\Shared.cs" />
<Compile Include="System\Linq\Parallel\Utils\Sorting.cs" />
<Compile Include="System\Linq\Parallel\Utils\TraceHelpers.cs" />
<Compile Include="System\Linq\Parallel\Utils\Util.cs" />
<Compile Include="System\Linq\Parallel\Utils\Wrapper.cs" />
<Compile Include="System\Linq\Parallel\Utils\WrapperEqualityComparer.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Collections" />
<Reference Include="System.Collections.Concurrent" />
<Reference Include="System.Diagnostics.Contracts" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Diagnostics.Tools" />
<Reference Include="System.Diagnostics.Tracing" />
<Reference Include="System.Linq" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Threading" />
<Reference Include="System.Threading.Tasks" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,136 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// SynchronousChannel.cs
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System.Collections.Generic;
using System.Diagnostics;
namespace System.Linq.Parallel
{
/// <summary>
/// The simplest channel is one that has no synchronization. This is used for stop-
/// and-go productions where we are guaranteed the consumer is not running
/// concurrently. It just wraps a FIFO queue internally.
///
/// Assumptions:
/// Producers and consumers never try to enqueue/dequeue concurrently.
/// </summary>
/// <typeparam name="T"></typeparam>
internal sealed class SynchronousChannel<T>
{
// We currently use the BCL FIFO queue internally, although any would do.
private Queue<T> _queue;
#if DEBUG
// In debug builds, we keep track of when the producer is done (for asserts).
private bool _done;
#endif
//-----------------------------------------------------------------------------------
// Instantiates a new queue.
//
internal SynchronousChannel()
{
}
//-----------------------------------------------------------------------------------
// Initializes the queue for this channel.
//
internal void Init()
{
_queue = new Queue<T>();
}
//-----------------------------------------------------------------------------------
// Enqueue a new item.
//
// Arguments:
// item - the item to place into the queue
// timeoutMilliseconds - synchronous channels never wait, so this is unused
//
// Assumptions:
// The producer has not signaled that it's done yet.
//
// Return Value:
// Synchronous channels always return true for this function. It can't timeout.
//
internal void Enqueue(T item)
{
Debug.Assert(_queue != null);
#if DEBUG
Debug.Assert(!_done, "trying to enqueue into the queue after production is done");
#endif
_queue.Enqueue(item);
}
//-----------------------------------------------------------------------------------
// Dequeue the next item in the queue.
//
// Return Value:
// The item removed from the queue.
//
// Assumptions:
// The producer must be done producing. This queue is meant for synchronous
// production/consumption, therefore it's unsafe for the consumer to try and
// dequeue an item while a producer might be enqueueing one.
//
internal T Dequeue()
{
Debug.Assert(_queue != null);
#if DEBUG
Debug.Assert(_done, "trying to dequeue before production is done -- this is not safe");
#endif
return _queue.Dequeue();
}
//-----------------------------------------------------------------------------------
// Signals that a producer will no longer be enqueueing items.
//
internal void SetDone()
{
#if DEBUG
// We only track this in DEBUG builds to aid in debugging. This ensures we
// can assert dequeue-before-done and enqueue-after-done invariants above.
_done = true;
#endif
}
//-----------------------------------------------------------------------------------
// Copies the internal contents of this channel to an array.
//
internal void CopyTo(T[] array, int arrayIndex)
{
Debug.Assert(array != null);
#if DEBUG
Debug.Assert(_done, "Can only copy from the channel after it's done being added to");
#endif
_queue.CopyTo(array, arrayIndex);
}
//-----------------------------------------------------------------------------------
// Retrieves the current count of items in the queue.
//
internal int Count
{
get
{
Debug.Assert(_queue != null);
return _queue.Count;
}
}
}
}

View File

@@ -0,0 +1,124 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// AggregationMinMaxHelpers.cs
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System.Collections.Generic;
using System.Linq.Parallel;
using System.Diagnostics;
namespace System.Linq
{
internal static class AggregationMinMaxHelpers<T>
{
//-----------------------------------------------------------------------------------
// Helper method to find the minimum or maximum element in the source.
//
private static T Reduce(IEnumerable<T> source, int sign)
{
Debug.Assert(source != null);
Debug.Assert(sign == -1 || sign == 1);
Func<Pair<bool, T>, T, Pair<bool, T>> intermediateReduce = MakeIntermediateReduceFunction(sign);
Func<Pair<bool, T>, Pair<bool, T>, Pair<bool, T>> finalReduce = MakeFinalReduceFunction(sign);
Func<Pair<bool, T>, T> resultSelector = MakeResultSelectorFunction();
AssociativeAggregationOperator<T, Pair<bool, T>, T> aggregation =
new AssociativeAggregationOperator<T, Pair<bool, T>, T>(source, new Pair<bool, T>(false, default(T)), null,
true, intermediateReduce, finalReduce, resultSelector, default(T) != null, QueryAggregationOptions.AssociativeCommutative);
return aggregation.Aggregate();
}
//-----------------------------------------------------------------------------------
// Helper method to find the minimum element in the source.
//
internal static T ReduceMin(IEnumerable<T> source)
{
return Reduce(source, -1);
}
//-----------------------------------------------------------------------------------
// Helper method to find the maximum element in the source.
//
internal static T ReduceMax(IEnumerable<T> source)
{
return Reduce(source, 1);
}
//-----------------------------------------------------------------------------------
// These methods are used to generate delegates to perform the comparisons.
//
private static Func<Pair<bool, T>, T, Pair<bool, T>> MakeIntermediateReduceFunction(int sign)
{
Comparer<T> comparer = Util.GetDefaultComparer<T>();
// Note that we capture the 'sign' argument and 'comparer' local, and therefore the C#
// compiler will transform this into an instance-based delegate, incurring an extra (hidden)
// object allocation.
return delegate (Pair<bool, T> accumulator, T element)
{
// If this is the first element, or the sign of the result of comparing the element with
// the existing accumulated result is equal to the sign requested by the function factory,
// we will return a new pair that contains the current element as the best item. We will
// ignore null elements (for reference and nullable types) in the input stream.
if ((default(T) != null || element != null) &&
(!accumulator.First || Util.Sign(comparer.Compare(element, accumulator.Second)) == sign))
{
return new Pair<bool, T>(true, element);
}
// Otherwise, just return the current accumulator result.
return accumulator;
};
}
private static Func<Pair<bool, T>, Pair<bool, T>, Pair<bool, T>> MakeFinalReduceFunction(int sign)
{
Comparer<T> comparer = Util.GetDefaultComparer<T>();
// Note that we capture the 'sign' argument and 'comparer' local, and therefore the C#
// compiler will transform this into an instance-based delegate, incurring an extra (hidden)
// object allocation.
return delegate (Pair<bool, T> accumulator, Pair<bool, T> element)
{
// If the intermediate reduction is empty, we will ignore it. Otherwise, if this is the
// first element, or the sign of the result of comparing the element with the existing
// accumulated result is equal to the sign requested by the function factory, we will
// return a new pair that contains the current element as the best item.
if (element.First &&
(!accumulator.First || Util.Sign(comparer.Compare(element.Second, accumulator.Second)) == sign))
{
Debug.Assert(default(T) != null || element.Second != null, "nulls unexpected in final reduce");
return new Pair<bool, T>(true, element.Second);
}
// Otherwise, just return the current accumulator result.
return accumulator;
};
}
private static Func<Pair<bool, T>, T> MakeResultSelectorFunction()
{
// If we saw at least one element in the source stream, the right pair element will contain
// the element we're looking for -- so we return that. In the case of non-nullable value
// types, the aggregation API will have thrown an exception before calling us for
// empty sequences. Else, we will just return the element, which may be null for other types.
return delegate (Pair<bool, T> accumulator)
{
Debug.Assert(accumulator.First || default(T) == null,
"for non-null types we expect an exception to be thrown before getting here");
return accumulator.Second;
};
}
}
}

View File

@@ -0,0 +1,72 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// EmptyEnumerable.cs
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System.Collections;
using System.Collections.Generic;
namespace System.Linq.Parallel
{
/// <summary>
/// We occasionally need a no-op enumerator to stand-in when we don't have data left
/// within a partition's data stream. These are simple enumerable and enumerator
/// implementations that always and consistently yield no elements.
/// </summary>
/// <typeparam name="T"></typeparam>
internal class EmptyEnumerable<T> : ParallelQuery<T>
{
private EmptyEnumerable()
: base(QuerySettings.Empty)
{
}
// A singleton cached and shared among callers.
private static volatile EmptyEnumerable<T> s_instance;
private static volatile EmptyEnumerator<T> s_enumeratorInstance;
internal static EmptyEnumerable<T> Instance
{
get
{
if (s_instance == null)
{
// There is no need for thread safety here.
s_instance = new EmptyEnumerable<T>();
}
return s_instance;
}
}
public override IEnumerator<T> GetEnumerator()
{
if (s_enumeratorInstance == null)
{
// There is no need for thread safety here.
s_enumeratorInstance = new EmptyEnumerator<T>();
}
return s_enumeratorInstance;
}
}
internal class EmptyEnumerator<T> : QueryOperatorEnumerator<T, int>, IEnumerator<T>
{
internal override bool MoveNext(ref T currentElement, ref int currentKey)
{
return false;
}
// IEnumerator<T> methods.
public T Current { get { return default(T); } }
object IEnumerator.Current { get { return null; } }
public bool MoveNext() { return false; }
void Collections.IEnumerator.Reset() { }
}
}

View File

@@ -0,0 +1,99 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// EnumerableWrapperWeakToStrong.cs
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
namespace System.Linq.Parallel
{
/// <summary>
/// A simple implementation of the IEnumerable{object} interface which wraps
/// a weakly typed IEnumerable object, allowing it to be accessed as a strongly typed
/// IEnumerable{object}.
/// </summary>
internal class EnumerableWrapperWeakToStrong : IEnumerable<object>
{
private readonly IEnumerable _wrappedEnumerable; // The wrapped enumerable object.
//-----------------------------------------------------------------------------------
// Instantiates a new wrapper object.
//
internal EnumerableWrapperWeakToStrong(IEnumerable wrappedEnumerable)
{
Debug.Assert(wrappedEnumerable != null);
_wrappedEnumerable = wrappedEnumerable;
}
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<object>)this).GetEnumerator();
}
public IEnumerator<object> GetEnumerator()
{
return new WrapperEnumeratorWeakToStrong(_wrappedEnumerable.GetEnumerator());
}
//-----------------------------------------------------------------------------------
// A wrapper over IEnumerator that provides IEnumerator<object> interface
//
class WrapperEnumeratorWeakToStrong : IEnumerator<object>
{
private IEnumerator _wrappedEnumerator; // The weakly typed enumerator we've wrapped.
//-----------------------------------------------------------------------------------
// Wrap the specified enumerator in a new weak-to-strong converter.
//
internal WrapperEnumeratorWeakToStrong(IEnumerator wrappedEnumerator)
{
Debug.Assert(wrappedEnumerator != null);
_wrappedEnumerator = wrappedEnumerator;
}
//-----------------------------------------------------------------------------------
// These are all really simple IEnumerator<object> implementations that simply
// forward to the corresponding weakly typed IEnumerator methods.
//
object IEnumerator.Current
{
get { return _wrappedEnumerator.Current; }
}
object IEnumerator<object>.Current
{
get { return _wrappedEnumerator.Current; }
}
void IDisposable.Dispose()
{
IDisposable disposable = _wrappedEnumerator as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
bool IEnumerator.MoveNext()
{
return _wrappedEnumerator.MoveNext();
}
void IEnumerator.Reset()
{
_wrappedEnumerator.Reset();
}
}
}
}

View File

@@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// IParallelPartitionable.cs
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
namespace System.Linq.Parallel
{
/// <summary>
///
/// An interface that allows developers to specify their own partitioning routines.
///
/// </summary>
/// <typeparam name="T"></typeparam>
internal interface IParallelPartitionable<T>
{
QueryOperatorEnumerator<T, int>[] GetPartitions(int partitionCount);
}
}

View File

@@ -0,0 +1,52 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// OrderedParallelQuery.cs
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq.Parallel;
using System.Diagnostics;
namespace System.Linq
{
/// <summary>
/// Represents a sorted, parallel sequence.
/// </summary>
public class OrderedParallelQuery<TSource> : ParallelQuery<TSource>
{
private QueryOperator<TSource> _sortOp;
internal OrderedParallelQuery(QueryOperator<TSource> sortOp)
: base(sortOp.SpecifiedQuerySettings)
{
_sortOp = sortOp;
Debug.Assert(sortOp is IOrderedEnumerable<TSource>);
}
internal QueryOperator<TSource> SortOperator
{
get { return _sortOp; }
}
internal IOrderedEnumerable<TSource> OrderedEnumerable
{
get { return (IOrderedEnumerable<TSource>)_sortOp; }
}
/// <summary>
/// Returns an enumerator that iterates through the sequence.
/// </summary>
/// <returns>An enumerator that iterates through the sequence.</returns>
public override IEnumerator<TSource> GetEnumerator()
{
return _sortOp.GetEnumerator();
}
}
}

View File

@@ -0,0 +1,94 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// ParallelEnumerableWrapper.cs
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
namespace System.Linq.Parallel
{
/// <summary>
/// A simple implementation of the ParallelQuery{object} interface which wraps an
/// underlying IEnumerable, such that it can be used in parallel queries.
/// </summary>
internal class ParallelEnumerableWrapper : ParallelQuery<object>
{
private readonly IEnumerable _source; // The wrapped enumerable object.
//-----------------------------------------------------------------------------------
// Instantiates a new wrapper object.
//
internal ParallelEnumerableWrapper(Collections.IEnumerable source)
: base(QuerySettings.Empty)
{
Debug.Assert(source != null);
_source = source;
}
internal override IEnumerator GetEnumeratorUntyped()
{
return _source.GetEnumerator();
}
public override IEnumerator<object> GetEnumerator()
{
return new EnumerableWrapperWeakToStrong(_source).GetEnumerator();
}
}
/// <summary>
/// A simple implementation of the ParallelQuery{T} interface which wraps an
/// underlying IEnumerable{T}, such that it can be used in parallel queries.
/// </summary>
/// <typeparam name="T"></typeparam>
internal class ParallelEnumerableWrapper<T> : ParallelQuery<T>
{
private readonly IEnumerable<T> _wrappedEnumerable; // The wrapped enumerable object.
//-----------------------------------------------------------------------------------
// Instantiates a new wrapper object.
//
// Arguments:
// wrappedEnumerable - the underlying enumerable object being wrapped
//
// Notes:
// The analysisOptions and degreeOfParallelism settings are optional. Passing null
// indicates that the system defaults should be used instead.
//
internal ParallelEnumerableWrapper(IEnumerable<T> wrappedEnumerable)
: base(QuerySettings.Empty)
{
Debug.Assert(wrappedEnumerable != null, "wrappedEnumerable must not be null.");
_wrappedEnumerable = wrappedEnumerable;
}
//-----------------------------------------------------------------------------------
// Retrieves the wrapped enumerable object.
//
internal IEnumerable<T> WrappedEnumerable
{
get { return _wrappedEnumerable; }
}
//-----------------------------------------------------------------------------------
// Implementations of GetEnumerator that just delegate to the wrapped enumerable.
//
public override IEnumerator<T> GetEnumerator()
{
Debug.Assert(_wrappedEnumerable != null);
return _wrappedEnumerable.GetEnumerator();
}
}
}

View File

@@ -0,0 +1,128 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// ParallelQuery.cs
//
// ParallelQuery is an abstract class that represents a PLINQ query.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System.Collections;
using System.Collections.Generic;
using System.Linq.Parallel;
using System.Diagnostics;
namespace System.Linq
{
/// <summary>
/// Represents a parallel sequence.
/// </summary>
public class ParallelQuery : IEnumerable
{
// Settings that have been specified on the query so far.
private QuerySettings _specifiedSettings;
internal ParallelQuery(QuerySettings specifiedSettings)
{
_specifiedSettings = specifiedSettings;
}
//-----------------------------------------------------------------------------------
// Settings that have been specified on the query so far. Some settings may still
// be unspecified and will be replaced either by operators further in the query,
// or filled in with defaults at query opening time.
//
internal QuerySettings SpecifiedQuerySettings
{
get { return _specifiedSettings; }
}
//-----------------------------------------------------------------------------------
// Returns a parallel enumerable that represents 'this' enumerable, with each element
// casted to TCastTo. If some element is not of type TCastTo, InvalidCastException
// is thrown.
//
internal virtual ParallelQuery<TCastTo> Cast<TCastTo>()
{
Debug.Fail("The derived class must override this method.");
throw new NotSupportedException();
}
//-----------------------------------------------------------------------------------
// Returns a parallel enumerable that represents 'this' enumerable, with each element
// casted to TCastTo. Elements that are not of type TCastTo will be left out from
// the results.
//
internal virtual ParallelQuery<TCastTo> OfType<TCastTo>()
{
Debug.Fail("The derived class must override this method.");
throw new NotSupportedException();
}
//-----------------------------------------------------------------------------------
// Derived classes implement GetEnumeratorUntyped() instead of IEnumerable.GetEnumerator()
// This is to avoid the method name conflict if the derived classes also implement
// IEnumerable<T>.
//
internal virtual IEnumerator GetEnumeratorUntyped()
{
Debug.Fail("The derived class must override this method.");
throw new NotSupportedException();
}
/// <summary>
/// Returns an enumerator that iterates through the sequence.
/// </summary>
/// <returns>An enumerator that iterates through the sequence.</returns>
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumeratorUntyped();
}
}
/// <summary>
/// Represents a parallel sequence.
/// </summary>
public class ParallelQuery<TSource> : ParallelQuery, IEnumerable<TSource>
{
internal ParallelQuery(QuerySettings settings)
: base(settings)
{
}
internal sealed override ParallelQuery<TCastTo> Cast<TCastTo>()
{
return ParallelEnumerable.Select<TSource, TCastTo>(this, elem => (TCastTo)(object)elem);
}
internal sealed override ParallelQuery<TCastTo> OfType<TCastTo>()
{
// @PERF: Currently defined in terms of other operators. This isn't the most performant
// solution (because it results in two operators) but is simple to implement.
return this
.Where<TSource>(elem => elem is TCastTo)
.Select<TSource, TCastTo>(elem => (TCastTo)(object)elem);
}
internal override IEnumerator GetEnumeratorUntyped()
{
return ((IEnumerable<TSource>)this).GetEnumerator();
}
/// <summary>
/// Returns an enumerator that iterates through the sequence.
/// </summary>
/// <returns>An enumerator that iterates through the sequence.</returns>
public virtual IEnumerator<TSource> GetEnumerator()
{
Debug.Fail("The derived class must override this method.");
throw new NotSupportedException();
}
}
}

View File

@@ -0,0 +1,42 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// QueryAggregationOptions.cs
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
namespace System.Linq.Parallel
{
/// <summary>
/// An enum to specify whether an aggregate operator is associative, commutative,
/// neither, or both. This influences query analysis and execution: associative
/// aggregations can run in parallel, whereas non-associative cannot; non-commutative
/// aggregations must be run over data in input-order.
/// </summary>
[Flags]
internal enum QueryAggregationOptions
{
None = 0,
Associative = 1,
Commutative = 2,
AssociativeCommutative = (Associative | Commutative) // For convenience.
// If you change the members, make sure you update IsDefinedQueryAggregationOptions() below.
}
internal static class QueryAggregationOptionsExtensions
{
// This helper is a workaround for the fact that Enum.Defined() does not work on non-public enums.
// There is a custom attribute in System.Reflection.Metadata.Controls that would make it work
// but we don't want to introduce a dependency on that contract just to support two asserts.
public static bool IsValidQueryAggregationOption(this QueryAggregationOptions value)
{
return value == QueryAggregationOptions.None
|| value == QueryAggregationOptions.Associative
|| value == QueryAggregationOptions.Commutative
|| value == QueryAggregationOptions.AssociativeCommutative;
}
}
}

View File

@@ -0,0 +1,124 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// RangeEnumerable.cs
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System.Collections.Generic;
namespace System.Linq.Parallel
{
/// <summary>
/// A simple enumerable type that implements the range algorithm. It also supports
/// partitioning of the indices by implementing an interface that PLINQ recognizes.
/// </summary>
internal class RangeEnumerable : ParallelQuery<int>, IParallelPartitionable<int>
{
private int _from; // Lowest index to include.
private int _count; // Number of indices to include.
//-----------------------------------------------------------------------------------
// Constructs a new range enumerable object for the specified range.
//
internal RangeEnumerable(int from, int count)
: base(QuerySettings.Empty)
{
// Transform the from and to indices into low and highs.
_from = from;
_count = count;
}
//-----------------------------------------------------------------------------------
// Retrieves 'count' partitions, each of which uses a non-overlapping set of indices.
//
public QueryOperatorEnumerator<int, int>[] GetPartitions(int partitionCount)
{
// Calculate a stride size, avoiding overflow if _count is large
int stride = _count / partitionCount;
int biggerPartitionCount = _count % partitionCount;
// Create individual partitions, carefully avoiding overflow
int doneCount = 0;
QueryOperatorEnumerator<int, int>[] partitions = new QueryOperatorEnumerator<int, int>[partitionCount];
for (int i = 0; i < partitionCount; i++)
{
int partitionSize = (i < biggerPartitionCount) ? stride + 1 : stride;
partitions[i] = new RangeEnumerator(
_from + doneCount,
partitionSize,
doneCount);
doneCount += partitionSize;
}
return partitions;
}
//-----------------------------------------------------------------------------------
// Basic IEnumerator<T> method implementations.
//
public override IEnumerator<int> GetEnumerator()
{
return new RangeEnumerator(_from, _count, 0).AsClassicEnumerator();
}
//-----------------------------------------------------------------------------------
// The actual enumerator that walks over the specified range.
//
class RangeEnumerator : QueryOperatorEnumerator<int, int>
{
private readonly int _from; // The initial value.
private readonly int _count; // How many values to yield.
private readonly int _initialIndex; // The ordinal index of the first value in the range.
private Shared<int> _currentCount; // The 0-based index of the current value. [allocate in moveNext to avoid false-sharing]
//-----------------------------------------------------------------------------------
// Creates a new enumerator.
//
internal RangeEnumerator(int from, int count, int initialIndex)
{
_from = from;
_count = count;
_initialIndex = initialIndex;
}
//-----------------------------------------------------------------------------------
// Basic enumeration method. This implements the logic to walk the desired
// range, using the step specified at construction time.
//
internal override bool MoveNext(ref int currentElement, ref int currentKey)
{
if (_currentCount == null)
_currentCount = new Shared<int>(-1);
// Calculate the next index and ensure it falls within our range.
int nextCount = _currentCount.Value + 1;
if (nextCount < _count)
{
_currentCount.Value = nextCount;
currentElement = nextCount + _from;
currentKey = nextCount + _initialIndex;
return true;
}
return false;
}
internal override void Reset()
{
// We set the current value such that the next addition of step
// results in the 1st real value in the range.
_currentCount = null;
}
}
}
}

View File

@@ -0,0 +1,124 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// RepeatEnumerable.cs
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System.Collections.Generic;
using System.Diagnostics;
namespace System.Linq.Parallel
{
/// <summary>
/// A simple enumerable type that implements the repeat algorithm. It also supports
/// partitioning of the count space by implementing an interface that PLINQ recognizes.
/// </summary>
/// <typeparam name="TResult"></typeparam>
internal class RepeatEnumerable<TResult> : ParallelQuery<TResult>, IParallelPartitionable<TResult>
{
private TResult _element; // Element value to repeat.
private int _count; // Count of element values.
//-----------------------------------------------------------------------------------
// Constructs a new repeat enumerable object for the repeat operation.
//
internal RepeatEnumerable(TResult element, int count)
: base(QuerySettings.Empty)
{
Debug.Assert(count >= 0, "count not within range (must be >= 0)");
_element = element;
_count = count;
}
//-----------------------------------------------------------------------------------
// Retrieves 'count' partitions, dividing the total count by the partition count,
// and having each partition produce a certain number of repeated elements.
//
public QueryOperatorEnumerator<TResult, int>[] GetPartitions(int partitionCount)
{
// Calculate a stride size.
int stride = (_count + partitionCount - 1) / partitionCount;
// Now generate the actual enumerators. Each produces 'stride' elements, except
// for the last partition which may produce fewer (if '_count' isn't evenly
// divisible by 'partitionCount').
QueryOperatorEnumerator<TResult, int>[] partitions = new QueryOperatorEnumerator<TResult, int>[partitionCount];
for (int i = 0, offset = 0; i < partitionCount; i++, offset += stride)
{
if ((offset + stride) > _count)
{
partitions[i] = new RepeatEnumerator(_element, offset < _count ? _count - offset : 0, offset);
}
else
{
partitions[i] = new RepeatEnumerator(_element, stride, offset);
}
}
return partitions;
}
//-----------------------------------------------------------------------------------
// Basic IEnumerator<T> method implementations.
//
public override IEnumerator<TResult> GetEnumerator()
{
return new RepeatEnumerator(_element, _count, 0).AsClassicEnumerator();
}
//-----------------------------------------------------------------------------------
// The actual enumerator that produces a set of repeated elements.
//
class RepeatEnumerator : QueryOperatorEnumerator<TResult, int>
{
private readonly TResult _element; // The element to repeat.
private readonly int _count; // The number of times to repeat it.
private readonly int _indexOffset; // Our index offset.
private Shared<int> _currentIndex; // The number of times we have already repeated it. [allocate in moveNext to avoid false-sharing]
//-----------------------------------------------------------------------------------
// Creates a new enumerator.
//
internal RepeatEnumerator(TResult element, int count, int indexOffset)
{
_element = element;
_count = count;
_indexOffset = indexOffset;
}
//-----------------------------------------------------------------------------------
// Basic IEnumerator<T> methods. These produce the repeating sequence..
//
internal override bool MoveNext(ref TResult currentElement, ref int currentKey)
{
if (_currentIndex == null)
_currentIndex = new Shared<int>(-1);
if (_currentIndex.Value < (_count - 1))
{
++_currentIndex.Value;
currentElement = _element;
currentKey = _currentIndex.Value + _indexOffset;
return true;
}
return false;
}
internal override void Reset()
{
_currentIndex = null;
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More