I'm looking for a template engine like freemarker (with select case directive) for writing a generator in C#.
Asked
Active
Viewed 1,073 times
2 Answers
1
I'm not familiar with freemarker, but I believe NVelocity may do what you're looking for.

Dathan
- 7,266
- 3
- 27
- 46
-
thanks Dathan, ive seen nvelocity, but it seems it has no select directive (although there is a implementacion in castle nvelocity port), i need the select directive to do this: select case field.type case int: bla , bla – Luis Molina Apr 14 '10 at 19:09
-
In most cases, `switch` or `select case` structures are just a shorthand way of representing an if/then/else control structure. (Exceptions are languages where `case` blocks are expressions, and if/then/else are statements). NVelocity does not have a `case` structure, but does have an [if/then/else control structure](http://velocity.apache.org/engine/devel/user-guide.html#Conditionals). – Dathan Apr 15 '10 at 15:33
-
youre right dathan, but i think its a more elegant way to do, its like using spaguetti programming or not... i was wrong with castle nvelocity, they dont use select case either, http://www.castleproject.org/others/nvelocity/improvements.html – Luis Molina Apr 16 '10 at 09:21
-
If it doesn't do what you want, you shouldn't accept my answer unless it turns out there isn't a better option for what you want to do. That having been said, if you're willing to consider commercial offerings, there's [CodeSmith](http://www.codesmithtools.com/). – Dathan Apr 16 '10 at 15:09
1
NVelocity is a template engine I've used to generate emails. Here's how your code might look.

Community
- 1
- 1

Darin Dimitrov
- 1,023,142
- 271
- 3,287
- 2,928