static void EmitPushDefaultArgumentValues(this MethodBody methodBody, MethodReference methodRef) { if (methodRef != null && methodRef.HasGenericParameters || methodRef.DeclaringType.HasGenericParameters) { throw new ArgumentException("Method reference must not point to a method of a non-closed gereric type.", "methodRef"); } foreach (var parameter in methodRef.Parameters) { var parameterType = parameter.ParameterType; methodBody.EmitPushDefaultValue(parameterType); } }