Regions In ASP.NET Views?

Velter picture Velter · Mar 22, 2011 · Viewed 41.3k times · Source

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.

something like:

#region blabla
    <p>@Model.Name</p>
    <p>...</p>
#endregion

This does not work. Is there an alternative?

Answer

Mustafa &#199;akıroğlu picture Mustafa Çakıroğlu · Mar 28, 2014

This works in Visual Studio 2015 and above (thanks to @dotnetN00b for the sample in the comments section):

<!-- #region Test -->

code here

<!-- #endregion -->