Created
April 9, 2015 19:22
-
-
Save jeremybeavon/1b7bba7d7bdc4b784005 to your computer and use it in GitHub Desktop.
LINQ Join Complex Condition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<TResult> Join<TOuter, TInner, TResult>( | |
this IEnumerable<TOuter> outer, | |
IEnumerable<TInner> inner, | |
Func<TOuter, TInner, bool> condition, | |
Func<TOuter, TInner, TResult> resultSelector) | |
{ | |
return from outerItem in outer | |
from innerItem in inner | |
where condition(outerItem, innerItem) | |
select resultSelector(outerItem, innerItem); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment