C# How to convert an Expression> to an Expression>

后端 未结 4 1687
轮回少年
轮回少年 2020-12-14 10:46

I have used C# expressions before based on lamdas, but I have no experience composing them by hand. Given an Expression> originalPredi

4条回答
  •  自闭症患者
    2020-12-14 11:26

    There is one other way I have found, that also includes wrapping your original delegate.

    Func ExpressionConversion(Expression> expression)
    {
        Expression> g = obj => expression.Compile().Invoke(obj);
        return g.Compile();
    }
    

提交回复
热议问题