Пример #1
0
        /// <summary>
        /// Initialises and populates a new GenericTypeRef instance based on the details
        /// provided in the metadata row.
        /// </summary>
        /// <param name="references">All the required references the create requires to build the type.</param>
        /// <param name="fromRow">The metadata row.</param>
        /// <returns>The populated instance.</returns>
        internal static GenericTypeRef CreateFromMetadata(BuildReferences references, GenericParamMetadataTableRow fromRow)
        {
            GenericTypeRef genericType = new GenericTypeRef();

            genericType.UniqueId = references.Assembly.CreateUniqueId();
            genericType.Sequence = (short)fromRow.Number;
            genericType.Name     = references.Assembly.StringStream.GetString(fromRow.Name.Value);
            // this.Flags = FieldReader.ToUInt16(contents, offset.Shift(2));

            return(genericType);
        }
Пример #2
0
            private void LoadGenericParameters()
            {
                var genericParameters = _metadataStream.Tables.GetGenericParametersFor(MetadataTables.TypeDef, _rowIndex + 1);

                if (genericParameters.Count > 0)
                {
                    foreach (GenericParamMetadataTableRow genParam in genericParameters)
                    {
                        _builtType.GenericTypes.Add(
                            GenericTypeRef.CreateFromMetadata(_references, genParam)
                            );
                    }
                }
            }
Пример #3
0
            private void LoadGenericParameters()
            {
                CallingConventions callingConvention = MethodDefSignature.GetCallingConvention(
                    _blobStream.GetSignitureContents((int)_methodToBuild.SignitureBlob.Value)
                    );
                bool isGenericMethod = (callingConvention & CallingConventions.Generic) != 0;

                if (isGenericMethod)
                {
                    List <GenericParamMetadataTableRow> genericParameters = _metadataStream.Tables.GetGenericParametersFor(
                        MetadataTables.MethodDef, _rowIndex + 1);
                    if (genericParameters.Count > 0)
                    {
                        _methodToBuild.IsGeneric = true;
                        foreach (GenericParamMetadataTableRow genParam in genericParameters)
                        {
                            _methodToBuild.GenericTypes.Add(
                                GenericTypeRef.CreateFromMetadata(_references, genParam)
                                );
                        }
                    }
                }
            }