public void TypedMethodInvocationMethodProperty() { var method = GetUnsavedMethodEmitter(false, typeof(string), new Type[0]); Expression newObject = new NewInstanceExpression(typeof(ReferenceType), Type.EmptyTypes); ExpressionReference newObjectReference = new ExpressionReference(typeof(ReferenceType), newObject, method); TypedMethodInvocationExpression expression = new TypedMethodInvocationExpression(newObjectReference, typeof(ReferenceType).GetMethod("Method")); Assert.That(expression.Method, Is.EqualTo(typeof(ReferenceType).GetMethod("Method"))); }
private void AddDelegatingCallStatements(MethodInfo methodToCall, TypeReference owner, bool callVirtual) { Expression[] argumentExpressions = GetArgumentExpressions(); TypedMethodInvocationExpression delegatingCall; if (callVirtual) { delegatingCall = new AutomaticMethodInvocationExpression(owner, methodToCall, argumentExpressions); } else { delegatingCall = new TypedMethodInvocationExpression(owner, methodToCall, argumentExpressions); } AddStatement(new ReturnStatement(delegatingCall)); }