user161433
user161433

Reputation: 4519

Is it possible to Code in MSIL?

I am just curious to know if this can be done or not. I don't plan on doing it if it dosen't pack some significant performance benefits. I am a web and game developer but I usually don't develop games in c#.

Upvotes: 4

Views: 903

Answers (4)

Jason Haley
Jason Haley

Reputation: 3800

The #Develop (Sharp Develop) IDE has a plugin for il projects. I haven't used it, so I'm not sure how much help it provides. http://www.icsharpcode.net/OpenSource/SD/

Upvotes: 0

Steven Sudit
Steven Sudit

Reputation: 19620

Or you could emit a bit of CIL from your C#. Feeding an object literal to ILGenerator

Upvotes: 0

Michael Petrotta
Michael Petrotta

Reputation: 60902

Yes, you can; Microsoft's MSIL Assembler (ilasm.exe) from the .NET SDK will compile your IL to executable code. I can't see any reason to do this, except in very focused areas, where you've found a substantial performance benefit to be gained.

Here's a detailed, if dated, article describing how to do this.

Upvotes: 1

Pavel Minaev
Pavel Minaev

Reputation: 101555

Yes, it is possible - you can use ilasm (comes with .NET SDK) to compile your code. There's no IDE support for that in Visual Studio, however. There aren't any performance benefits that you can derive from this that you wouldn't be able to get by other means - specifically, C++/CLI covers all low-level CLR features that may provide some benefit and are inaccessible from C# or VB - most notably, no-copy (ref) unboxing, plain unbounded function pointers (as opposed to delegates) and the associated calli IL instruction, and ref (managed pointer in CLI parlance) local variables (as opposed to just parameters).

Upvotes: 14

Related Questions