Sometimes it is useful to be able to write IL directly. However, we
cannot do it in C# as you can do with assembler code in C or C++. But IL
is .NET Framework's assembler code, isn't it?
I know some other compilers like F# have this feature, which I find
tremendously useful. So, I think a new language extension should be
defined to express this. My suggestion is something like that
unsafe int __il
{
ldarg.0
ldarg.1
add
}
The same code in F# can be written like this
(# "ldarg.0
ldarg.1
add" : int )
I think the code should be marked as unsafe because we never know what
could the developer do in IL. This allows us to use it directly instead
of needing Reflection, that is much more verbose, and much less efficient.
I have posted this suggestion also in MSDN Product Feedback. You can see
it in
http://lab.msdn.microsoft.com/Produc...ckId=FDBK20847
Vote it if you like it!!