11

IKVM.Reflection.Emit has "the ability to read and emit .NET 1.1, .NET 2.0 and .NET 4.0 assemblies (while running on, for example, .NET 2.0).".

Does Mono.Cecil have the same? Are they interchangable for this use case? Are they both supported nowadays? What are key differences between them (in emitting IL)?

Vlad
  • 2,560
  • 1
  • 17
  • 38

1 Answers1

3

I know this has been an old question, but I'd like to provide an answer. IKVM.Reflection.Emit API was invented when its author was tired of System.Reflection.Emit and Cecil.Reflection.Emit. In order to make IKVMC compiler faster, he worked from scratch to design this new API.

The history can be found from the following blog posts,

2008 Aug Switch from Microsoft .NET reflection to Cecil

2008 Nov Switch from Cecil to IKVM.Reflection.Emit

2010 Jan Announce IKVM.Reflection

So generally speaking IKVM.Reflection and Cecil have similar functionalities, and IKVM.Reflection API should be faster in many ways.

Up-to-now you can still see Cecil is widely used in many utilities (such as Obfuscar, an obfuscation tool I am maintaining). IKVM.Reflection is mainly used in Mono C# compiler and IKVM itself, and I am not sure whether there are other projects using it (but should be many).

Lex Li
  • 52,595
  • 8
  • 102
  • 129