Skip to content

Instantly share code, notes, and snippets.

@caseywatson
Created September 29, 2016 20:20
Show Gist options
  • Select an option

  • Save caseywatson/ba611b1c8724c9c3fd166cf3e33ac78f to your computer and use it in GitHub Desktop.

Select an option

Save caseywatson/ba611b1c8724c9c3fd166cf3e33ac78f to your computer and use it in GitHub Desktop.
For when you just want to OrderBy yourself...
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