Share via


HpcLinqQueryable.SumAsQuery Method (IQueryable)

Creates a query that you can run later to compute the sum of a set of Int64 values.

Namespace: Microsoft.Hpc.Linq
Assembly: Microsoft.Hpc.Linq (in Microsoft.Hpc.Linq.dll)

Usage

'Usage
Dim source As IQueryable(Of Long)
Dim returnValue As IQueryable(Of Long)

returnValue = HpcLinqQueryable.SumAsQuery(source)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function SumAsQuery ( _
    source As IQueryable(Of Long) _
) As IQueryable(Of Long)
[ExtensionAttribute] 
public static IQueryable<long> SumAsQuery (
    IQueryable<long> source
)
[ExtensionAttribute] 
public:
static IQueryable<long long>^ SumAsQuery (
    IQueryable<long long>^ source
)
/** @attribute ExtensionAttribute() */ 
public static IQueryable<long> SumAsQuery (
    IQueryable<long> source
)
ExtensionAttribute 
public static function SumAsQuery (
    source : IQueryable<long>
) : IQueryable<long>

Parameters

Return Value

An IQueryable interface for the query.

Exceptions

Exception type Condition
ArgumentNullException

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

Remarks

Use this method if you want to perform the same query as the Sum method, but want to delay running the query instead of generating results immediately.

Use the Submit method to run the query. Use the GetEnumerator method or the foreach statement of the C# language (For Each in Visual Basic) to get the results of the query. The enumerator contains a single Int64 element, which is the sum of the specified set of values.

To create a query that calculates the sum of a set of Int64 values that are calculated from a set of records by using a specified function, use the SumAsQuery(Generic IQueryable,Generic Expression) form of the method. For information about versions of this method that calculate the sum for values with other data types, see the SumAsQuery method.

In Visual Basic and C#, you can call this method as an instance method on any object of type IQueryable<Int64>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

For more information about how the query runs and its behavior, see the Remarks section for the Sum method.

Platform Note: This method was introduced in Windows HPC Server 2008 R2 with Service Pack 2 (SP2) and is not supported in previous versions.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP, Windows Vista, Windows 7, Windows 8, Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012

Target Platforms

Windows XP, Windows Vista, Windows 7, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, with HPC Pack Client Utilities

See Also

Reference

HpcLinqQueryable Class
HpcLinqQueryable Members
Microsoft.Hpc.Linq Namespace
Sum
SumAsQuery(Generic IQueryable,Generic Expression)
Sum

Build Date:

2013-04-22