ParallelEnumerable.Sum Method

Definition

Computes in parallel the sum of a sequence of values.

Overloads

Sum(ParallelQuery<Nullable<Single>>)

Computes in parallel the sum of a sequence of values.

Sum(ParallelQuery<Nullable<Int64>>)

Computes in parallel the sum of a sequence of values.

Sum(ParallelQuery<Nullable<Int32>>)

Computes in parallel the sum of a sequence of values.

Sum(ParallelQuery<Nullable<Double>>)

Computes in parallel the sum of a sequence of values.

Sum(ParallelQuery<Single>)

Computes in parallel the sum of a sequence of values.

Sum(ParallelQuery<Int64>)

Computes in parallel the sum of a sequence of values.

Sum(ParallelQuery<Int32>)

Computes in parallel the sum of a sequence of values.

Sum(ParallelQuery<Double>)

Computes in parallel the sum of a sequence of values.

Sum(ParallelQuery<Decimal>)

Computes in parallel the sum of a sequence of values.

Sum(ParallelQuery<Nullable<Decimal>>)

Computes in parallel the sum of a sequence of values.

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Single>)

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Decimal>)

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Double>)

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Int32>)

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Int64>)

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Nullable<Decimal>>)

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Nullable<Double>>)

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Nullable<Int32>>)

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Nullable<Int64>>)

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Nullable<Single>>)

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

Sum(ParallelQuery<Nullable<Single>>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of a sequence of values.

C#
public static float? Sum(this System.Linq.ParallelQuery<float?> source);

Parameters

source
ParallelQuery<Nullable<Single>>

A sequence of values to calculate the sum of.

Returns

The sum of the projected values in the sequence.

Exceptions

source is a null reference (Nothing in Visual Basic).

The sum is larger than Single.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum(ParallelQuery<Nullable<Int64>>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of a sequence of values.

C#
public static long? Sum(this System.Linq.ParallelQuery<long?> source);

Parameters

source
ParallelQuery<Nullable<Int64>>

A sequence of values to calculate the sum of.

Returns

The sum of the projected values in the sequence.

Exceptions

source is a null reference (Nothing in Visual Basic).

The sum is larger than Int64.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum(ParallelQuery<Nullable<Int32>>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of a sequence of values.

C#
public static int? Sum(this System.Linq.ParallelQuery<int?> source);

Parameters

source
ParallelQuery<Nullable<Int32>>

A sequence of values to calculate the sum of.

Returns

The sum of the projected values in the sequence.

Exceptions

source is a null reference (Nothing in Visual Basic).

The sum is larger than Int32.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum(ParallelQuery<Nullable<Double>>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of a sequence of values.

C#
public static double? Sum(this System.Linq.ParallelQuery<double?> source);

Parameters

source
ParallelQuery<Nullable<Double>>

A sequence of values to calculate the sum of.

Returns

The sum of the projected values in the sequence.

Exceptions

source is a null reference (Nothing in Visual Basic).

The sum is larger than Double.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum(ParallelQuery<Single>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of a sequence of values.

C#
public static float Sum(this System.Linq.ParallelQuery<float> source);

Parameters

source
ParallelQuery<Single>

A sequence of values to calculate the sum of.

Returns

The sum of the projected values in the sequence.

Exceptions

source is a null reference (Nothing in Visual Basic).

The sum is larger than Single.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum(ParallelQuery<Int64>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of a sequence of values.

C#
public static long Sum(this System.Linq.ParallelQuery<long> source);

Parameters

source
ParallelQuery<Int64>

A sequence of values to calculate the sum of.

Returns

The sum of the projected values in the sequence.

Exceptions

source is a null reference (Nothing in Visual Basic).

The sum is larger than Int64.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum(ParallelQuery<Int32>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of a sequence of values.

C#
public static int Sum(this System.Linq.ParallelQuery<int> source);

Parameters

source
ParallelQuery<Int32>

A sequence of values to calculate the sum of.

Returns

The sum of the projected values in the sequence.

Exceptions

source is a null reference (Nothing in Visual Basic).

The sum is larger than Int32.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum(ParallelQuery<Double>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of a sequence of values.

C#
public static double Sum(this System.Linq.ParallelQuery<double> source);

Parameters

source
ParallelQuery<Double>

A sequence of values to calculate the sum of.

Returns

The sum of the projected values in the sequence.

Exceptions

source is a null reference (Nothing in Visual Basic).

The sum is larger than Double.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum(ParallelQuery<Decimal>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of a sequence of values.

C#
public static decimal Sum(this System.Linq.ParallelQuery<decimal> source);

Parameters

source
ParallelQuery<Decimal>

A sequence of values to calculate the sum of.

Returns

The sum of the projected values in the sequence.

Exceptions

source is a null reference (Nothing in Visual Basic).

The sum is larger than Decimal.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum(ParallelQuery<Nullable<Decimal>>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of a sequence of values.

C#
public static decimal? Sum(this System.Linq.ParallelQuery<decimal?> source);

Parameters

source
ParallelQuery<Nullable<Decimal>>

A sequence of values to calculate the sum of.

Returns

The sum of the projected values in the sequence.

Exceptions

source is a null reference (Nothing in Visual Basic).

The sum is larger than Decimal.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Single>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

C#
public static float Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,float> selector);

Type Parameters

TSource

The type of elements of source.

Parameters

source
ParallelQuery<TSource>

A sequence of values to calculate the sum of.

selector
Func<TSource,Single>

A transform function to apply to each element.

Returns

The sum of the projected values in the sequence.

Exceptions

source or selector is a null reference (Nothing in Visual Basic).

The sum is larger than Single.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Decimal>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

C#
public static decimal Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,decimal> selector);

Type Parameters

TSource

The type of elements of source.

Parameters

source
ParallelQuery<TSource>

A sequence of values to calculate the sum of.

selector
Func<TSource,Decimal>

A transform function to apply to each element.

Returns

The sum of the projected values in the sequence.

Exceptions

source or selector is a null reference (Nothing in Visual Basic).

The sum is larger than Decimal.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Double>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

C#
public static double Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,double> selector);

Type Parameters

TSource

The type of elements of source.

Parameters

source
ParallelQuery<TSource>

A sequence of values to calculate the sum of.

selector
Func<TSource,Double>

A transform function to apply to each element.

Returns

The sum of the projected values in the sequence.

Exceptions

source or selector is a null reference (Nothing in Visual Basic).

The sum is larger than Double.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Int32>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

C#
public static int Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,int> selector);

Type Parameters

TSource

The type of elements in the source sequence.

Parameters

source
ParallelQuery<TSource>

A sequence of values to calculate the sum of.

selector
Func<TSource,Int32>

A transform function to apply to each element.

Returns

The sum of the projected values in the sequence.

Exceptions

source or selector is a null reference (Nothing in Visual Basic).

The sum is larger than Int32.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Int64>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

C#
public static long Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,long> selector);

Type Parameters

TSource

The type of elements of source.

Parameters

source
ParallelQuery<TSource>

A sequence of values to calculate the sum of.

selector
Func<TSource,Int64>

A transform function to apply to each element.

Returns

The sum of the projected values in the sequence.

Exceptions

source or selector is a null reference (Nothing in Visual Basic).

The sum is larger than Int64.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Nullable<Decimal>>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

C#
public static decimal? Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,decimal?> selector);

Type Parameters

TSource

The type of elements of source.

Parameters

source
ParallelQuery<TSource>

A sequence of values to calculate the sum of.

selector
Func<TSource,Nullable<Decimal>>

A transform function to apply to each element.

Returns

The sum of the projected values in the sequence.

Exceptions

source or selector is a null reference (Nothing in Visual Basic).

The sum is larger than Decimal.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Nullable<Double>>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

C#
public static double? Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,double?> selector);

Type Parameters

TSource

The type of elements of source.

Parameters

source
ParallelQuery<TSource>

A sequence of values to calculate the sum of.

selector
Func<TSource,Nullable<Double>>

A transform function to apply to each element.

Returns

The sum of the projected values in the sequence.

Exceptions

source or selector is a null reference (Nothing in Visual Basic).

The sum is larger than Double.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Nullable<Int32>>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

C#
public static int? Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,int?> selector);

Type Parameters

TSource

The type of elements of source.

Parameters

source
ParallelQuery<TSource>

A sequence of values to calculate the sum of.

selector
Func<TSource,Nullable<Int32>>

A transform function to apply to each element.

Returns

The sum of the projected values in the sequence.

Exceptions

source or selector is a null reference (Nothing in Visual Basic).

The sum is larger than Int32.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Nullable<Int64>>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

C#
public static long? Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,long?> selector);

Type Parameters

TSource

The type of elements of source.

Parameters

source
ParallelQuery<TSource>

A sequence of values to calculate the sum of.

selector
Func<TSource,Nullable<Int64>>

A transform function to apply to each element.

Returns

The sum of the projected values in the sequence.

Exceptions

source or selector is a null reference (Nothing in Visual Basic).

The sum is larger than Int64.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Sum<TSource>(ParallelQuery<TSource>, Func<TSource,Nullable<Single>>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Computes in parallel the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.

C#
public static float? Sum<TSource>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,float?> selector);

Type Parameters

TSource

The type of elements of source.

Parameters

source
ParallelQuery<TSource>

A sequence of values to calculate the sum of.

selector
Func<TSource,Nullable<Single>>

A transform function to apply to each element.

Returns

The sum of the projected values in the sequence.

Exceptions

source or selector is a null reference (Nothing in Visual Basic).

The sum is larger than Single.MaxValue. -or- One or more exceptions occurred during the evaluation of the query.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0