Created
June 2, 2010 04:52
-
-
Save detroitpro/421948 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 QueryableExtensions { | |
| public static IQueryable<TSource> WhereIf<TSource>( | |
| this IQueryable<TSource> source, bool condition, | |
| Expression<Func<TSource, bool>> predicate) { | |
| if (condition) | |
| return source.Where(predicate); | |
| else | |
| return source; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment