Antlr4.StringTemplate.Misc.ObjectModelAdaptor.BuildAccessor C# (CSharp) Method

BuildAccessor() private static method

private static BuildAccessor ( System.Reflection.FieldInfo field ) : object>.System.Func
field System.Reflection.FieldInfo
return object>.System.Func
        private static System.Func<object, object> BuildAccessor(FieldInfo field)
        {
            ParameterExpression obj = Expression.Parameter(typeof(object), "obj");
            UnaryExpression instance = !field.IsStatic ? Expression.Convert(obj, field.DeclaringType) : null;
            Expression<System.Func<object, object>> expr = Expression.Lambda<System.Func<object, object>>(
                Expression.Convert(
                    Expression.Field(instance, field),
                    typeof(object)),
                obj);

            return expr.Compile();
        }

Same methods

ObjectModelAdaptor::BuildAccessor ( System.Reflection.MethodInfo method ) : object>.System.Func
ObjectModelAdaptor::BuildAccessor ( System.Reflection.MethodInfo method, string argument ) : object>.System.Func