Created
September 16, 2015 08:08
-
-
Save kmorcinek/7728c3153dd1b62c393f to your computer and use it in GitHub Desktop.
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 class IQueryableExtensions | |
{ | |
public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>( | |
this IQueryable<TSource> source, | |
Expression<Func<TSource, TKey>> keySelector, | |
bool isAscending) | |
{ | |
if (isAscending) | |
{ | |
return source.OrderBy(keySelector); | |
} | |
else | |
{ | |
return source.OrderByDescending(keySelector); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment