将内部 class 更改为 public (CIL, Mono.Cecil)

Changing internal class to public (CIL, Mono.Cecil)

有没有办法通过 CIL 获取类间类型并将其更改为 public?

AssemblyDefinition x = AssemblyDefinition.ReadAssembly("x.dll");
TypeDefinition type = x.MainModule.GetType("Class");
AssemblyDefinition adef = AssemblyDefinition.ReadAssembly("x.dll");
TypeDefinition tdef = adef.MainModule.GetType("Class");
tdef.IsPublic = true;
adef.MainModule.Write("x_updated.dll");