For years, Lutz Roeder’s .NET Reflector enjoyed prominence as the industry-leading .NET Decompiler. It would decompile any .NET Assembly into the format of your choice, including C#, IL, Delphi.NET and Oxygene. After Red Gate purchased .NET Reflector, they decided to move it from a free tool with a commercial upgrade option to a pay-only tool. This created an opportunity for a new free .NET decompiler to fill the void.
[A week ago](http://blogs.jetbrains.com/dotnet/2011/05/free-net-decompiler-is-available-for-early-access/), JetBrains released their new free [dotPeek](http://www.jetbrains.com/decompiler/) decompiler in an early-access program. Right away, I noticed that it only supports decompiling to C#, instead of the variety of languages that .NET Reflector offered. It is important to realize that the language used to build the .NET assembly is irrelevant. All .NET languages compile down to the same IL, with the only differences being based on the features offered by the language.

JetBrains dotPeek 1.0 EAP. Build 1.0.0.1219

Not to worry though, the Oxygene support in Delphi Prism includes the ‘Paste C# as Oxygene’ option. By default, you can access it from the context menu within any Oxygene source file or bind it to a hot key.
Paste C# as Oxygene
Sometimes, there will be TODO comments indicating code that may need to be adjusted. You may also need to change the names of classes, namespaces, etc. When you are done, the decompiled .NET code is Oxygene Code – ready to compile and run in your next Delphi Prism application.
method Base64Encoder.Encode(buffer:arrayof System.Byte; &index: System.Int32; count: System.Int32);beginif buffer =nilthenraisenew ArgumentNullException('buffer')elseif &index <0thenraisenew ArgumentOutOfRangeException('index')elseif count <0thenraisenew ArgumentOutOfRangeException('count')elseif count > buffer.Length- &indexthenbeginraisenew ArgumentOutOfRangeException('count')endelsebeginifself.leftOverBytesCount >0thenbegin//. . . .

While the ‘Paste C# as Oxygene’ code could produce code that is compatible with our new Cooper compiler, any references to the .NET Framework would need to be replaced, so it isn’t nearly as useful.