Created
January 23, 2022 00:30
-
-
Save Jay-Madden/0a87fb4ebf318cc67b4312e51d40eac2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 class LinqExtensions | |
{ | |
public static IQueryable<T> QueryIfElse<T>(this IQueryable<T> query, | |
Func<bool> predicate, | |
Func<IQueryable<T>, IQueryable<T>> @if, | |
Func<IQueryable<T>, IQueryable<T>> @else) => | |
predicate() ? @if(query) : @else(query); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment