Skip to content

Instantly share code, notes, and snippets.

@nguerrera
Created March 21, 2018 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nguerrera/c672cb728a96a24837408b5d1c6ca7e6 to your computer and use it in GitHub Desktop.
Save nguerrera/c672cb728a96a24837408b5d1c6ca7e6 to your computer and use it in GitHub Desktop.
using System;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using System.Reflection.PortableExecutable;
class Program
{
static void Main()
{
using (var pe = new PEReader(...))
{
MetadataReader md = pe.GetMetadataReader();
for (int row = 1, count = md.GetTableRowCount(TableIndex.TypeSpec); row <= count; row++)
{
TypeSpecificationHandle handle = MetadataTokens.TypeSpecificationHandle(row);
TypeSpecification specification = md.GetTypeSpecification(handle);
...
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment