This project is read-only.

Domain Specific Language for C# code generation

IMPORTANT: Repository is now at Github:

CsBuilder is a strong example of the power that C# offers in creating Domain Specific Languages. It aims to generate C# code through a fluent interface that mimics real C# code.

A collection of classes modeling C# code is behind a facade of methods heavily relying in lambda expressions to achieve the feeling of coding.

 using(ICodeWriter codeWriter = new CodeWriter(new StreamWriter(File.Create("sum.cs"))))
  Cs.Class("Sum", c =>
   c.Method("DoSum", m =>
    var a = Cs.Var("a");
    var b = Cs.Var("b");

    m.Return(a + b);
   }).OfType(CsType.Int).Param("a", CsType.Int).Param("b", CsType.Int);


Last edited Jul 9, 2013 at 9:17 PM by jorgehmv, version 5