private int GetMemberRefToken(MethodBase methodInfo, Type[] optionalParameterTypes) { if (optionalParameterTypes != null && (methodInfo.CallingConvention & CallingConventions.VarArgs) == 0) { throw new InvalidOperationException(SR.InvalidOperation_NotAVarArgCallingConvention); } RuntimeMethodInfo rtMeth = methodInfo as RuntimeMethodInfo; DynamicMethod dm = methodInfo as DynamicMethod; if (rtMeth == null && dm == null) { throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(methodInfo)); } SignatureHelper.ExtractParametersTypeArrays( methodInfo.GetParametersNoCopy(), out Type[] parameterTypes, out Type[][] parameterTypeRequiredCustomModifiers,