Skip to content

Instantly share code, notes, and snippets.

@mvidacovich
mvidacovich / SortHelper.cs
Created July 29, 2015 18:23
Queryable extension for sorting on strings
void Main()
{
var collection = Student; // all students
collection.OrderBy("FirstName",true).Skip(0).Take(50).Select (s => new {s.StudentId, s.FirstName}).Dump();
collection.OrderBy("FirstName",true).Skip(50).Take(50).Select (s => new {s.StudentId, s.FirstName}).Dump();
}
public static class SortHelper
{
public static IQueryable<T> OrderBy<T>(this IQueryable<T> queryable, string propertyName, bool asc)