Enumerable.LeftJoin Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
|
LeftJoin |
Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys. |
|
LeftJoin |
Correlates the elements of two sequences based on matching keys. A specified IEqualityComparer |
|
LeftJoin |
LeftJoin(IEnumerable, IEnumerable, Func, Func, Func)
- Source:
- LeftJoin.cs
- Source:
- LeftJoin.cs
Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IEnumerable ^ LeftJoin(System::Collections::Generic::IEnumerable ^ outer, System::Collections::Generic::IEnumerable ^ inner, Func ^ outerKeySelector, Func ^ innerKeySelector, Func ^ resultSelector);
public static System.Collections.Generic.IEnumerable LeftJoin(this System.Collections.Generic.IEnumerable outer, System.Collections.Generic.IEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector);
static member LeftJoin : seq<'Outer> * seq<'Inner> * Func<'Outer, 'Key> * Func<'Inner, 'Key> * Func<'Outer, 'Inner, 'Result> -> seq<'Result>
Public Function LeftJoin(Of TOuter, TInner, TKey, TResult) (outer As IEnumerable(Of TOuter), inner As IEnumerable(Of TInner), outerKeySelector As Func(Of TOuter, TKey), innerKeySelector As Func(Of TInner, TKey), resultSelector As Func(Of TOuter, TInner, TResult)) As IEnumerable(Of TResult)
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.
Parameters
- outer
-
IEnumerable
The first sequence to join.
- inner
-
IEnumerable
The sequence to join to the first sequence.
- outerKeySelector
-
Func
A function to extract the join key from each element of the first sequence.
- innerKeySelector
-
Func
A function to extract the join key from each element of the second sequence.
- resultSelector
-
Func
A function to create a result element from two matching elements.
Returns
An IEnumerableTResult that are obtained by performing a left outer join on two sequences.
Exceptions
outer or inner or outerKeySelector or innerKeySelector or resultSelector is null.
Remarks
This method is implemented by using deferred execution. The immediate return value is an object that stores all the information that is required to perform the action. The query represented by this method is not executed until the object is enumerated either by calling its GetEnumerator method directly or by using foreach in C# or For Each in Visual Basic.
The default equality comparer, Default, is used to hash and compare keys.
A join refers to the operation of correlating the elements of two sources of information based on a common key.
LeftJoin
In relational database terms, the LeftJoin
'Outer left' means that elements of the first sequence are returned regardless of whether matching elements are found in the other sequence.
An 'equijoin' is a join in which the keys are compared for equality.
An inner join - where only elements that have a match in the other sequence are included in the results - can be performed using the Join
For more information, see Join operations.
Applies to
LeftJoin(IEnumerable, IEnumerable,
Func, Func, Func,
IEqualityComparer)
- Source:
- LeftJoin.cs
- Source:
- LeftJoin.cs
Correlates the elements of two sequences based on matching keys. A specified IEqualityComparer
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IEnumerable ^ LeftJoin(System::Collections::Generic::IEnumerable ^ outer, System::Collections::Generic::IEnumerable ^ inner, Func ^ outerKeySelector, Func ^ innerKeySelector, Func ^ resultSelector, System::Collections::Generic::IEqualityComparer ^ comparer);
public static System.Collections.Generic.IEnumerable LeftJoin(this System.Collections.Generic.IEnumerable outer, System.Collections.Generic.IEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector, System.Collections.Generic.IEqualityComparer? comparer);
static member LeftJoin : seq<'Outer> * seq<'Inner> * Func<'Outer, 'Key> * Func<'Inner, 'Key> * Func<'Outer, 'Inner, 'Result> * System.Collections.Generic.IEqualityComparer<'Key> -> seq<'Result>
Public Function LeftJoin(Of TOuter, TInner, TKey, TResult) (outer As IEnumerable(Of TOuter), inner As IEnumerable(Of TInner), outerKeySelector As Func(Of TOuter, TKey), innerKeySelector As Func(Of TInner, TKey), resultSelector As Func(Of TOuter, TInner, TResult), comparer As IEqualityComparer(Of TKey)) As IEnumerable(Of TResult)
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.
Parameters
- outer
-
IEnumerable
The first sequence to join.
- inner
-
IEnumerable
The sequence to join to the first sequence.
- outerKeySelector
-
Func
A function to extract the join key from each element of the first sequence.
- innerKeySelector
-
Func
A function to extract the join key from each element of the second sequence.
- resultSelector
-
Func
A function to create a result element from two matching elements.
- comparer
-
IEqualityComparer
An IEqualityComparer
Returns
An IEnumerableTResult that are obtained by performing a left outer join on two sequences.
Exceptions
outer or inner or outerKeySelector or innerKeySelector or resultSelector is null.
Remarks
This method is implemented by using deferred execution. The immediate return value is an object that stores all the information that is required to perform the action. The query represented by this method is not executed until the object is enumerated either by calling its GetEnumerator method directly or by using foreach in C# or For Each in Visual Basic.
The default equality comparer, Default, is used to hash and compare keys.
A join refers to the operation of correlating the elements of two sources of information based on a common key.
LeftJoin
In relational database terms, the LeftJoin
'Outer left' means that elements of the first sequence are returned regardless of whether matching elements are found in the other sequence.
An 'equijoin' is a join in which the keys are compared for equality.
An inner join - where only elements that have a match in the other sequence are included in the results - can be performed using the Join
For more information, see Join operations.
Applies to
LeftJoin(IEnumerable, IEnumerable, Func, Func, IEqualityComparer)
- Source:
- LeftJoin.cs
public static System.Collections.Generic.IEnumerable<(TOuter Outer, TInner? Inner)> LeftJoin(this System.Collections.Generic.IEnumerable outer, System.Collections.Generic.IEnumerable inner, Func outerKeySelector, Func innerKeySelector, System.Collections.Generic.IEqualityComparer? comparer = default);
static member LeftJoin : seq<'Outer> * seq<'Inner> * Func<'Outer, 'Key> * Func<'Inner, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> seq>
Public Function LeftJoin(Of TOuter, TInner, TKey) (outer As IEnumerable(Of TOuter), inner As IEnumerable(Of TInner), outerKeySelector As Func(Of TOuter, TKey), innerKeySelector As Func(Of TInner, TKey), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As IEnumerable(Of ValueTuple(Of TOuter, TInner))
Type Parameters
- TOuter
- TInner
- TKey
Parameters
- outer
-
IEnumerable
- inner
-
IEnumerable
- outerKeySelector
-
Func
- innerKeySelector
-
Func
- comparer
-
IEqualityComparer