private static BuildAccessor ( System.Reflection.MethodInfo method ) : object>.System.Func | ||
method | System.Reflection.MethodInfo | |
Результат | object>.System.Func |
private static System.Func<object, object> BuildAccessor(MethodInfo method)
{
ParameterExpression obj = Expression.Parameter(typeof(object), "obj");
UnaryExpression instance = !method.IsStatic ? Expression.Convert(obj, method.DeclaringType) : null;
Expression<System.Func<object, object>> expr = Expression.Lambda<System.Func<object, object>>(
Expression.Convert(
Expression.Call(instance, method),
typeof(object)),
obj);
return expr.Compile();
}
ObjectModelAdaptor::BuildAccessor ( System.Reflection.FieldInfo field ) : object>.System.Func | |
ObjectModelAdaptor::BuildAccessor ( System.Reflection.MethodInfo method, string argument ) : object>.System.Func |