使用示例
using System;using Microsoft.VisualStudio.TestTools.UnitTesting;using RazorEngine;using RazorEngine.Templating;namespace P2P.Tests{ [TestClass] public class RazorUnitTest1 { [TestMethod] public void TestMethod1() { string template = "Hello @Model.Name, welcome to RazorEngine!"; var result = Engine.Razor.RunCompile(template, "templateKey", null, new { Name = "World" }); Console.Write(result); } }}
评论