相关疑难解决方法(0)

必须在非泛型静态类中定义扩展方法

我收到错误:

必须在非泛型静态类中定义扩展方法

在线上:

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)

.net c# linq extension-methods compiler-errors

198
推荐指数
8
解决办法
28万
查看次数

标签 统计

.net ×1

c# ×1

compiler-errors ×1

extension-methods ×1

linq ×1