Setup: load the references required to work with the decompiler
```csharp
#r "ICSharpCode.Decompiler"
#r "Mono.Cecil"
#r "System.Reflection.Metadata"
using Mono.Cecil;
using System.Reflection.Metadata;
using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.CSharp;
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;
// Version sanity check
@ -29,13 +30,15 @@ You must have compiled **frontends.sln** first (run “dotnet build” in ICShar
@@ -29,13 +30,15 @@ You must have compiled **frontends.sln** first (run “dotnet build” in ICShar
var decompiler = new CSharpDecompiler(fileName, new DecompilerSettings());
var module = new PEFile(fileName);
var assemblyResolver = new UniversalAssemblyResolver(fileName, true, module.Reader.DetectTargetFrameworkId());
var decompiler = new CSharpDecompiler(module, assemblyResolver, new DecompilerSettings());
```
Get the count of types in this assembly
Get the count of types in this module
```csharp
var types = decompiler.TypeSystem.Compilation.MainAssembly.GetAllTypeDefinitions();
var types = decompiler.TypeSystem.MainModule.TypeDefinitions;
Console.WriteLine(types.Count());
```
@ -51,22 +54,22 @@ If you want to decompile one single member (sample: first property)
@@ -51,22 +54,22 @@ If you want to decompile one single member (sample: first property)
```csharp
var nameOfUniResolver = new FullTypeName("ICSharpCode.Decompiler.UniversalAssemblyResolver");