Author: David Ebbo's blog | Posted on: 6/3/2009 12:53:05 PM | Views : 1156

There are many scenarios where the need to generate source code arises.  The MVC helpers I introduced in my last post is one such example.  Note that I am focusing on generating source code here, and not on scenarios where you may want to generate IL directly (which certainly do exist as well, but it?s a difference discussion). To perform the code generation, there are several different approaches that can be used.  The most simplistic one is to use a plain StringBuilder and write whatever code you want to it.  It?s rather primitive, but for simple scenarios, it just might be good enough. For more complex scenarios there are two widely different approaches that I will be discussing here: CodeDom and T4 templates.  Let...(read more) ...

Go to the complete details ...