C# template engine

me picture me · Oct 5, 2009 · Viewed 66.5k times · Source

I am looking for a stand-alone, easy to use from C# code, template engine. I want to create an HTML and XML files with placeholders for data, and fill them with data from my code.

The engine needs to support loops (duplicating parts of the template form more that one object) and conditions (add parts of the template to the final HTML/XML only if some conditions are true). Can someone recommend a good option for me, and add a link to more-or-less such code sample, and some documentation about how to use the recommended component for my needs?

I also need to use loops to duplicate table rows, or even entire tables (in the HTML version) and complex elements (in the XML version).

Answer