Exemple #1
0
        /// <summary>
        /// Emit generic instantiation type.
        /// </summary>
        /// <param name="typeInstHandle">Instantiated type specification signature handle</param>
        /// <param name="namespaceQualified">When set to true, include namespace information</param>
        private void EmitTypeInstantiationName(TypeInstantiationSignatureHandle typeInstHandle, bool namespaceQualified)
        {
            // Stack trace metadata ignores the instantiation arguments of the type in the CLR
            TypeInstantiationSignature typeInst = _metadataReader.GetTypeInstantiationSignature(typeInstHandle);

            EmitTypeName(typeInst.GenericType, namespaceQualified);
        }
Exemple #2
0
        /// <summary>
        /// Emit generic instantiation type.
        /// </summary>
        /// <param name="typeInstHandle">Instantiated type specification signature handle</param>
        /// <param name="namespaceQualified">When set to true, include namespace information</param>
        private void EmitTypeInstantiationName(TypeInstantiationSignatureHandle typeInstHandle, bool namespaceQualified)
        {
            TypeInstantiationSignature typeInst = _metadataReader.GetTypeInstantiationSignature(typeInstHandle);

            EmitTypeName(typeInst.GenericType, namespaceQualified);
            EmitGenericArguments(typeInst.GenericTypeArguments);
        }
        public static string GetFullName(this TypeInstantiationSignatureHandle typeInstSigHandle, MetadataReader reader)
        {
            var typeInstSig = typeInstSigHandle.GetTypeInstantiationSignature(reader);

            if (typeInstSig.GenericType.IsNull(reader))
            {
                return(null);
            }

            var name = typeInstSig.GenericType.GetFullName(reader);

            if (name == null)
            {
                return(null);
            }

            var    index      = 0;
            string argsString = null;

            foreach (var argHandle in typeInstSig.GenericTypeArguments)
            {
                if (index > 0)
                {
                    argsString += ",";
                }
                var argName = argHandle.GetFullName(reader);
                if (argName == null)
                {
                    return(name);
                }
                argsString += argName;
                index++;
            }
            return(name + "<" + argsString + ">");
        }
Exemple #4
0
        } // Read

        public static uint Read(this NativeReader reader, uint offset, out TypeInstantiationSignatureHandle handle)
        {
            uint value;

            offset = reader.DecodeUnsigned(offset, out value);
            handle = new TypeInstantiationSignatureHandle((int)value);
            handle._Validate();
            return(offset);
        } // Read