Is Lightweight Code Generation (LCG) dead?
Posted
by Greg Beech
on Stack Overflow
See other posts from Stack Overflow
or by Greg Beech
Published on 2010-06-08T23:03:48Z
Indexed on
2010/06/08
23:12 UTC
Read the original article
Hit count: 276
In the .NET 2.0-3.5 frameworks, LCG (aka the DynamicMethod class) was a decent way to emit lightweight methods at runtime when no class structure was needed to support them.
In .NET 4.0, expression trees now support statements and blocks, and as such appear to provide sufficient functionality to build just about any functionality you could require from such a method, and can be constructed in a much easier and safer way than directly emitting CIL op-codes. (This statement is borne from today's experimentation of converting some of our most complex LCG code to use expression tree building and compilation instead.)
So is there any reason why one would use LCG in any new code? Is there anything it can do that expression trees cannot? Or is it now a 'dead' piece of functionality?
© Stack Overflow or respective owner