コード例 #1
0
 public void FillInMetadataDescribedParameters(ref VirtualRuntimeParameterInfoArray result, QSignatureTypeHandle[] typeSignatures, MethodBase contextMethod, TypeContext typeContext)
 {
     foreach (ParameterHandle parameterHandle in _method.GetParameters())
     {
         Parameter parameterRecord = _reader.GetParameter(parameterHandle);
         int       index           = parameterRecord.SequenceNumber;
         result[index] =
             EcmaFormatMethodParameterInfo.GetEcmaFormatMethodParameterInfo(
                 contextMethod,
                 _methodHandle,
                 index - 1,
                 parameterHandle,
                 typeSignatures[index],
                 typeContext);
     }
 }
コード例 #2
0
        //
        // Returns the ParameterInfo objects for the method parameters and return parameter.
        //
        // The ParameterInfo objects will report "contextMethod" as their Member property and use it to get type variable information from
        // the contextMethod's declaring type. The actual metadata, however, comes from "this."
        //
        // The methodTypeArguments provides the fill-ins for any method type variable elements in the parameter type signatures.
        //
        // Does not array-copy.
        //
        public                                          RuntimeParameterInfo[] GetRuntimeParameters(MethodBase contextMethod, RuntimeTypeInfo[] methodTypeArguments, out RuntimeParameterInfo returnParameter)
        {
            MetadataReader reader      = _reader;
            TypeContext    typeContext = contextMethod.DeclaringType.CastToRuntimeTypeInfo().TypeContext;

            typeContext = new TypeContext(typeContext.GenericTypeArguments, methodTypeArguments);
            QSignatureTypeHandle[] typeSignatures = this.MethodSignature;
            int count = typeSignatures.Length;

            VirtualRuntimeParameterInfoArray result = new VirtualRuntimeParameterInfoArray(count);

            foreach (ParameterHandle parameterHandle in _method.GetParameters())
            {
                Parameter parameterRecord = _reader.GetParameter(parameterHandle);
                int       index           = parameterRecord.SequenceNumber;
                result[index] =
                    EcmaFormatMethodParameterInfo.GetEcmaFormatMethodParameterInfo(
                        contextMethod,
                        _methodHandle,
                        index - 1,
                        parameterHandle,
                        typeSignatures[index],
                        typeContext);
            }
            for (int i = 0; i < count; i++)
            {
                if (result[i] == null)
                {
                    result[i] =
                        RuntimeThinMethodParameterInfo.GetRuntimeThinMethodParameterInfo(
                            contextMethod,
                            i - 1,
                            typeSignatures[i],
                            typeContext);
                }
            }

            returnParameter = result.First;
            return(result.Remainder);
        }