Описание тега razorengine

Antaris RazorEngine is a parsing engine that allows robust templates using Razor syntax.

The RazorEngine is a parsing engine that allows robust templates using razor syntax.

From the project web site:

Using the templating engine couldn't be easier, using a simple syntax, we can do the following:

string template = "Hello @Model.Name! Welcome to Razor!";
string result = Razor.Parse(template, new { Name = "World" });

The templating engine supports strict and anonymous types, as well as customised base templates, for instance:

Razor.SetTemplateBase(typeof(HtmlTemplateBase<>));

string template = 
@"<html>
  <head>
    <title>Hello @Model.Name</title>
  </head>
  <body>
    Email: @Html.TextBoxFor(m => m.Email)
  </body>
  </html>";

var model = new PageModel { Name = "World", Email = "someone@somewhere.com" };
string result = Razor.Parse(template, model);