GetTypeByMetadataToken() public method

public GetTypeByMetadataToken ( string moduleName, int mdTypeDefToken ) : ClrType
moduleName string
mdTypeDefToken int
return ClrType
Example #1
0
            private void TryGetTypeByMetadataToken(ArgumentOrLocal argOrLocal, IXCLRDataTypeInstance typeInstance)
            {
                object tmp;

                if (typeInstance.GetDefinition(out tmp) != HR.S_OK)
                {
                    return;
                }

                IXCLRDataTypeDefinition typeDefinition = (IXCLRDataTypeDefinition)tmp;
                int typeTok;

                if (HR.S_OK == typeDefinition.GetTokenAndScope(out typeTok, out tmp))
                {
                    IXCLRDataModule module = (IXCLRDataModule)tmp;
                    argOrLocal.ClrType = _context.GetTypeByMetadataToken(
                        GetModuleName(module), typeTok);
                    // This might fail if we don't have that type cached (unlikely)
                    // or if the type is generic, which makes the token non-unique.
                }
            }