且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用剃刀视图引擎在一个控制台应用程序?

更新时间:2023-02-17 20:59:51

有一个开源项目,它允许使用剃须刀作为一般的模板引擎:这就是所谓的RazorEngine (在code在 GitHub上

There is an open source project which allows to use Razor as a general templating engine: it's called RazorEngine (the code in on GitHub)

该项目的页面的示例:

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