HpcLinqQueryable.LongSelectMany Method (IQueryable, Expression, Expression)
Transforms each record in a set of records to an IEnumerable interface for a set of multiple objects by using an index that is an Int64 in the first function that you specify, then applies a second specified function to each of the objects that result from that transformation, and combines those sets of objects that the second function produces into one set.
Namespace: Microsoft.Hpc.Linq
Assembly: Microsoft.Hpc.Linq (in Microsoft.Hpc.Linq.dll)
Usage
'Usage
Dim source As IQueryable(Of TSource)
Dim selector As Expression(Of Func(Of TSource, Long, IEnumerable(Of TCollection)))
Dim resultSelector As Expression(Of Func(Of TSource, TCollection, TResult))
Dim returnValue As IQueryable(Of TResult)
returnValue = HpcLinqQueryable.LongSelectMany(source, selector, resultSelector)
Syntax
'Declaration
<ExtensionAttribute> _
Public Shared Function LongSelectMany(Of TSource, TCollection, TResult) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Long, IEnumerable(Of TCollection))), _
resultSelector As Expression(Of Func(Of TSource, TCollection, TResult)) _
) As IQueryable(Of TResult)
[ExtensionAttribute]
public static IQueryable<TResult> LongSelectMany<TSource,TCollection,TResult> (
IQueryable<TSource> source,
Expression<Func<TSource,long,IEnumerable<TCollection>>> selector,
Expression<Func<TSource,TCollection,TResult>> resultSelector
)
[ExtensionAttribute]
public:
generic<typename TSource, typename TCollection, typename TResult>
static IQueryable<TResult>^ LongSelectMany (
IQueryable<TSource>^ source,
Expression<Func<TSource, long long, IEnumerable<TCollection>^>^>^ selector,
Expression<Func<TSource, TCollection, TResult>^>^ resultSelector
)
J# supports the use of generic APIs, but not the declaration of new ones.
JScript does not support generic types or methods.
GenericParameters
- TSource
The type of the records in the source parameter.
- TCollection
The type of the objects in the set of objects returned by the function that the selector parameter specifies.
- TResult
The type of the objects in the set of objects returned by the function that the resultSelector parameter specifies.
Parameters
- source
A System.Linq.IQueryable<TSource> interface for the set of records that you want to process.
- selector
A System.Linq.Expressions.Expression(Func(TSource, Int64, IEnumerable<TCollection>)) object that specifies a function that transforms the record into multiple objects. The second parameter of this function represents the index of the source element.
- resultSelector
A System.Linq.Expressions.Expression(Func(TSource, TCollection, TResult)) object that specifies a function that transforms the objects in the intermediate result into the final desired form.
Return Value
An IQueryable object that contains elements are the result of calling the function that the selector parameter specifies on each record in the set of input records, and then calling the function that the resultSelector parameter specifies on each of the objects in the output of the first function.
Exceptions
| Exception type | Condition |
|---|---|
| ArgumentNullException | The specified source, selector or resultSelector parameter is a null reference (Nothing in Visual Basic). |
Remarks
Use this method if you want to perform the same query as the SelectMany method, but want to use an index that is an Int64 rather than an Int32 in the first function that transforms the record.
To transform the records in a set of records into multiple objects by using a function that does not depend on the index of the record, and then apply a second function to the results of the first function, use the SelectMany method.
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 the transformed form of the set of records specified in the source parameter.
In Visual Basic and C#, you can call this method as an instance method on any object of type IQueryable<TSource>. 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).
This method has at least one parameter of type Expression with a type argument that is one of the Func types. For these parameters, you can pass in a lambda expression and it compiles to an Expression.
For more information about how the query runs and its behavior, see the Remarks section for the SelectMany 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
SelectMany
SelectMany
Build Date:
2013-04-22