V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
SystemLight
V2EX  ›  C#

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

  •  
  •   SystemLight · Dec 7, 2020 · 2807 views
    This topic created in 1974 days ago, the information mentioned may be changed or developed.

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

    5 replies    2020-12-09 00:53:41 +08:00
    xclin163
        1
    xclin163  
       Dec 7, 2020
    C# 里有 T4 啊
    SystemLight
        2
    SystemLight  
    OP
       Dec 7, 2020
    @xclin163 感觉 T4 模板语法不简洁,而且没用过
    forgottencoast
        3
    forgottencoast  
       Dec 8, 2020
    SystemLight
        4
    SystemLight  
    OP
       Dec 8, 2020
    @forgottencoast 有什么特殊的搜索技巧么,为什么我感觉我总是感觉自己搜出来的都是一大堆没用的内容呢
    forgottencoast
        5
    forgottencoast  
       Dec 9, 2020
    @SystemLight 关键字 Razor template engine 或者问句 how to use razor engine template
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2317 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 15:51 · PVG 23:51 · LAX 08:51 · JFK 11:51
    ♥ Do have faith in what you're doing.