📜  c# 表达式 func 自动选择返回类型 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:47.453000             🧑  作者: Mango

代码示例1
// If property is something like an int or double and you want an object,
// you need to manually convert it to an object via another expression.
var parameter = Expression.Parameter(typeof(T));
var body = Expression.Property(parameter, propertyName);
var converted = Expression.Convert(body, typeof(object));
return Expression.Lambda>(converted, parameter);