Using Razor engine on strings - not views

后端 未结 3 1651
囚心锁ツ
囚心锁ツ 2021-01-12 08:26

I\'d like to use the Razor engine without view (cshtml) files, but on strings. I want to do it from within MVC, I\'ve seen examples that use

new RazorViewE         


        
3条回答
  •  甜味超标
    2021-01-12 09:00

    There is a RazorParser class with Parse method which takes TextReader as an input parameter. However whole System.Web.Razor.Parser namespace is marked as

    This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

    so you have to figure it out by yourself.

提交回复
热议问题