RazorEngine是一个模板引擎
1、下载
2、建一个winform窗体应用
private void button1_Click(object sender, EventArgs e) { var template = "Hello @Model.Name, welcome to use RazorEngine!"; var result = RazorEngine.Engine.Razor.RunCompile(template, "templateKey1", null, new { Name = "World" }); richTextBox1.Text = result; }
3、运行结果