Exemplo n.º 1
0
        public override IEnumerable GetValues()
        {
            yield return Value("SignatureBlobIdx", row.SignatureBlobIdx);

            TypeSpecSignature signature = new TypeSpecSignature(Metadata, row.SignatureBlobIdx);
            yield return Value("Signature Token", signature.Token);
            yield return Value("Signature Type", signature.Type.ToString());
        }
        /// <summary>
        /// Resolves the type specification
        /// </summary>
        /// <param name="typeSpecToken">The type spec token.</param>
        /// <returns></returns>
        private RuntimeType ResolveTypeSpec(TokenTypes typeSpecToken)
        {
            int typeSpecIndex = (int)(typeSpecToken & TokenTypes.RowIndexMask) - 1;

            if (typeSpecs[typeSpecIndex] == null)
            {
                TypeSpecRow typeSpec = metadata.ReadTypeSpecRow(typeSpecToken);

                TypeSpecSignature signature = new TypeSpecSignature(metadata, typeSpec.SignatureBlobIdx);

                if (signature.Type.Type == CilElementType.Class || signature.Type.Type == CilElementType.ValueType || signature.Type.Type == CilElementType.GenericInst)
                {
                    GenericInstSigType genericSig = signature.Type as GenericInstSigType;

                    if (genericSig != null)
                    {
                        RuntimeType genericType = ResolveSignatureType(signature.Type);

                        typeSpecs[typeSpecIndex] = genericType;
                    }
                }
            }

            return typeSpecs[typeSpecIndex];
        }