V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
SystemLight
V2EX  ›  C#

C# 应该如何使用 Razor 引擎编译字符串,然后输出到文件 ?

  •  
  •   SystemLight · 2020-12-07 15:25:54 +08:00 · 1727 次点击
    这是一个创建于 1207 天前的主题,其中的信息可能已经有所发展或是发生改变。

    想要通过 C#中模板引擎制作一个代码块拼接的工具,手动读取文件判断标识符的效率不高,所以想要使用模板引擎来完成这个工作,有什么方法可以调用 Razor 呢!

    5 条回复    2020-12-09 00:53:41 +08:00
    xclin163
        1
    xclin163  
       2020-12-07 16:40:05 +08:00
    C# 里有 T4 啊
    SystemLight
        2
    SystemLight  
    OP
       2020-12-07 16:56:44 +08:00
    @xclin163 感觉 T4 模板语法不简洁,而且没用过
    forgottencoast
        3
    forgottencoast  
       2020-12-08 16:36:51 +08:00
    SystemLight
        4
    SystemLight  
    OP
       2020-12-08 22:15:51 +08:00
    @forgottencoast 有什么特殊的搜索技巧么,为什么我感觉我总是感觉自己搜出来的都是一大堆没用的内容呢
    forgottencoast
        5
    forgottencoast  
       2020-12-09 00:53:41 +08:00
    @SystemLight 关键字 Razor template engine 或者问句 how to use razor engine template
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1713 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 16:42 · PVG 00:42 · LAX 09:42 · JFK 12:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.