public SetReturnType ( System returnType ) : void | ||
returnType | System | |
return | void |
public void SetReturnType(System.Type returnType) { }
public void SetSignature(System.Type returnType, System.Type[] returnTypeRequiredCustomModifiers, System.Type[] returnTypeOptionalCustomModifiers, System.Type[] parameterTypes, System.Type[][] parameterTypeRequiredCustomModifiers, System.Type[][] parameterTypeOptionalCustomModifiers) { }
/// <summary> /// Copies the method signature from one method to another. /// This includes generic parameters, constraints and parameters. /// </summary> /// <param name="sourceMethod">The source method.</param> /// <param name="targetMethod">The target method.</param> internal static void CopyMethodSignature(MethodInfo sourceMethod, MethodBuilder targetMethod) { CopyGenericSignature(sourceMethod, targetMethod); targetMethod.SetReturnType(sourceMethod.ReturnType); // copy the parameters and attributes // it seems that we can use the source parameters directly because the target method is derived // from the source method var parameters = sourceMethod.GetParameters(); targetMethod.SetParameters(parameters.Select(p => p.ParameterType).ToArray()); for (int i = 0; i < parameters.Length; i++) { var parameter = parameters[i]; targetMethod.DefineParameter(i + 1, parameter.Attributes, parameter.Name); } }