我的表达是
Expression<Func<TSource,TResult>>
对于其他原始类型
我正在创建表达式
Expression<Func<TSource,int>>, Expression<Func<TSource,string>>
但是如果在枚举
的情况下如何指定TResult实施例
getExpression<TSource, int>(expression)// for integer
getExpression<TSource, string>(expression) // for string
getExpression<TSource, Enum>(expression) // It reruns null
private Expression<Func<TSource, TResult>> getExpression<TSource, TResult>(Expression expression)
{
var x = expression as Expression<Func<TSource, TMember>>;
return x;
}