我收到错误:
必须在非泛型静态类中定义扩展方法
在线上:
public class LinqHelper
Run Code Online (Sandbox Code Playgroud)
这是基于Mark Gavells代码的助手类.我真的很困惑这个错误意味着什么,因为我确信它在周五离开时工作正常!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Linq.Expressions;
using System.Reflection;
/// <summary>
/// Helper methods for link
/// </summary>
public class LinqHelper
{
public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> source, string property)
{
return ApplyOrder<T>(source, property, "OrderBy");
}
public static IOrderedQueryable<T> OrderByDescending<T>(this IQueryable<T> source, string property)
{
return ApplyOrder<T>(source, property, "OrderByDescending");
}
public static IOrderedQueryable<T> ThenBy<T>(this IOrderedQueryable<T> source, string property)
{
return ApplyOrder<T>(source, property, "ThenBy");
}
public static IOrderedQueryable<T> ThenByDescending<T>(this IOrderedQueryable<T> …Run Code Online (Sandbox Code Playgroud)