Created
September 29, 2016 20:20
-
-
Save caseywatson/ba611b1c8724c9c3fd166cf3e33ac78f to your computer and use it in GitHub Desktop.
For when you just want to OrderBy yourself...
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
| using System.Collections.Generic; | |
| using System.Linq; | |
| namespace Mantle.Extensions | |
| { | |
| public static class EnumerableExtensions | |
| { | |
| public static IOrderedEnumerable<T> Order<T>(this IEnumerable<T> source) | |
| { | |
| if (source == null) | |
| throw new ArgumentNullException(nameof(source)); | |
| return (source.OrderBy(i => i)); | |
| } | |
| public static IOrderedEnumerable<T> OrderDescending<T>(this IEnumerable<T> source) | |
| { | |
| if (source == null) | |
| throw new ArgumentNullException(nameof(source)); | |
| return (source.OrderByDescending(i => i)); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment