Namespace:
System.Linq
Assembly:
System.Core (in System.Core.dll)
Visual Basic (Declaration)
<ExtensionAttribute> _
Public Shared Function Join(Of TOuter, TInner, TKey, TResult) ( _
outer As IQueryable(Of TOuter), _
inner As IEnumerable(Of TInner), _
outerKeySelector As Expression(Of Func(Of TOuter, TKey)), _
innerKeySelector As Expression(Of Func(Of TInner, TKey)), _
resultSelector As Expression(Of Func(Of TOuter, TInner, TResult)), _
comparer As IEqualityComparer(Of TKey) _
) As IQueryable(Of TResult)
Dim outer As IQueryable(Of TOuter)
Dim inner As IEnumerable(Of TInner)
Dim outerKeySelector As Expression(Of Func(Of TOuter, TKey))
Dim innerKeySelector As Expression(Of Func(Of TInner, TKey))
Dim resultSelector As Expression(Of Func(Of TOuter, TInner, TResult))
Dim comparer As IEqualityComparer(Of TKey)
Dim returnValue As IQueryable(Of TResult)
returnValue = outer.Join(inner, outerKeySelector, _
innerKeySelector, resultSelector, _
comparer)
public static IQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(
this IQueryable<TOuter> outer,
IEnumerable<TInner> inner,
Expression<Func<TOuter, TKey>> outerKeySelector,
Expression<Func<TInner, TKey>> innerKeySelector,
Expression<Func<TOuter, TInner, TResult>> resultSelector,
IEqualityComparer<TKey> comparer
)
[ExtensionAttribute]
public:
generic<typename TOuter, typename TInner, typename TKey, typename TResult>
static IQueryable<TResult>^ Join(
IQueryable<TOuter>^ outer,
IEnumerable<TInner>^ inner,
Expression<Func<TOuter, TKey>^>^ outerKeySelector,
Expression<Func<TInner, TKey>^>^ innerKeySelector,
Expression<Func<TOuter, TInner, TResult>^>^ resultSelector,
IEqualityComparer<TKey>^ comparer
)
JScript does not support generic types or methods.
Type Parameters
- TOuter
The type of the elements of the first sequence.
- TInner
The type of the elements of the second sequence.
- TKey
The type of the keys returned by the key selector functions.
- TResult
The type of the result elements.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IQueryable<(Of <(TOuter>)>). 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).
| Exception | Condition |
|---|
| ArgumentNullException |
outer or inner or outerKeySelector or innerKeySelector or resultSelector is nullNothingnullptra null reference (Nothing in Visual Basic). |
This method has at least one parameter of type Expression<(Of <(TDelegate>)>) whose type argument is one of the Func<(Of <(T, TResult>)>) types. For these parameters, you can pass in a lambda expression and it will be compiled to an Expression<(Of <(TDelegate>)>).
The Join<(Of <(TOuter, TInner, TKey, TResult>)>)(IQueryable<(Of <(TOuter>)>), IEnumerable<(Of <(TInner>)>), Expression<(Of <(Func<(Of <(TOuter, TKey>)>)>)>), Expression<(Of <(Func<(Of <(TInner, TKey>)>)>)>), Expression<(Of <(Func<(Of <(TOuter, TInner, TResult>)>)>)>), IEqualityComparer<(Of <(TKey>)>)) method generates a MethodCallExpression that represents calling Join<(Of <(TOuter, TInner, TKey, TResult>)>)(IQueryable<(Of <(TOuter>)>), IEnumerable<(Of <(TInner>)>), Expression<(Of <(Func<(Of <(TOuter, TKey>)>)>)>), Expression<(Of <(Func<(Of <(TInner, TKey>)>)>)>), Expression<(Of <(Func<(Of <(TOuter, TInner, TResult>)>)>)>), IEqualityComparer<(Of <(TKey>)>)) itself as a constructed generic method. It then passes the MethodCallExpression to the CreateQuery<(Of <(TElement>)>)(Expression) method of the IQueryProvider represented by the Provider property of the outer parameter.
The query behavior that occurs as a result of executing an expression tree that represents calling Join<(Of <(TOuter, TInner, TKey, TResult>)>)(IQueryable<(Of <(TOuter>)>), IEnumerable<(Of <(TInner>)>), Expression<(Of <(Func<(Of <(TOuter, TKey>)>)>)>), Expression<(Of <(Func<(Of <(TInner, TKey>)>)>)>), Expression<(Of <(Func<(Of <(TOuter, TInner, TResult>)>)>)>), IEqualityComparer<(Of <(TKey>)>)) depends on the implementation of the type of the outer parameter. The expected behavior is that of an inner join. The outerKeySelector and innerKeySelector functions are used to extract keys from outer and inner, respectively. These keys are compared for equality by using comparer. The outcome of the comparisons is used to create a matching pair for each element in inner that matches an element in outer. Then the resultSelector function is invoked to project a result object from each pair of matching elements.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5
Reference