System.Linq.Expressions.Expression.GetInvokeMethod C# (CSharp) Method

GetInvokeMethod() static private method

Gets the delegate's Invoke method; used by InvocationExpression.
static private GetInvokeMethod ( Expression expression ) : MethodInfo
expression Expression The expression to be invoked.
return System.Reflection.MethodInfo
        internal static MethodInfo GetInvokeMethod(Expression expression)
        {
            Type delegateType = expression.Type;
            if (!expression.Type.IsSubclassOf(typeof(MulticastDelegate)))
            {
                Type exprType = TypeUtils.FindGenericType(typeof(Expression<>), expression.Type);
                if (exprType == null)
                {
                    throw Error.ExpressionTypeNotInvocable(expression.Type, nameof(expression));
                }
                delegateType = exprType.GetGenericArguments()[0];
            }

            return delegateType.GetMethod("Invoke");
        }
    }
Expression