问题描述
我正在使用剃刀引擎制作一个 ASP.NET MVC 应用程序.我想知道是否可以在视图中使用 Regions.
I am making an ASP.NET MVC application with the razor engine. And I was wondering if it's possible to use Regions in a view.
类似:
#region blabla
<p>@Model.Name</p>
<p>...</p>
#endregion
这不起作用.有没有替代方案?
This does not work. Is there an alternative?
推荐答案
这适用于 Visual Studio 2015 及更高版本(感谢 @dotnetN00b
在评论部分提供示例):
This works in Visual Studio 2015 and above
(thanks to @dotnetN00b
for the sample in the comments section):
<!-- #region Test -->
code here
<!-- #endregion -->