开发者

What's the significance of Razor's ability to pass a template to a method

I've seen it referenced a couple times now - most recently in thi开发者_StackOverflow中文版s article:

Also using Razor template you can pass template as a parameter to a method.

It would be helpful to hear about the real-life problems this ability solves.

thx


This ability is a natural effect of how Razor actually works. It's something that's available because Razor requires this capability internally.

For a real-life example take a look at my blog post on Razor sections with default content. You can use it to write the following code:

@this.RenderSection("OptionalSection", @<div>Default Content</div>) 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜