This project is read-only.
For type and member declaration there is Define static class.
Below is example how to define class cls
CodeTypeDeclaration cls = Define.Class("cls");
There is another approach to define class - use extension method AddClass of type CodeNamespace
CodeNamespace ns = new CodeNamespace("TestNS");
CodeTypeDeclaration cls = ns.AddClass(Define.Class("cls"));
AddClass extension also can accept class name parameter
CodeNamespace ns = new CodeNamespace("TestNS");
CodeTypeDeclaration cls = ns.AddClass("cls");
The code can be generated via CodeDomGenerator class. CodeDomGenerator has AddNamespace method so the whole program may looks like
static void Main()
    var c = new CodeDomGenerator();


And the resulting code is
namespace TestNS {
    public class cls {
All high level abstructions and their relationships defined in my blog.

Last edited May 16, 2009 at 11:41 AM by AlexShirshov, version 5


No comments yet.