NVelocity

This is a simple templating tool.

Here is the documentation for the templates.

This is what you need to get NVelocity to work:

NVelocity.Context.IContext context = new VelocityContext();

context.Put(“name”, “Chris”);

NVelocity.Runtime.RuntimeSingleton.Init();
NVelocity.Template template = NVelocity.Runtime.RuntimeSingleton.GetTemplate(“helloworld.vm”);

StringWriter writer = new StringWriter();

template.Merge(context, writer);

Console.WriteLine(writer.ToString());

Here  is the template:

Hello $name!  Welcome to Velocity!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s