SO, , , View, # boolean (IsDebug - ) , View .
, - :
bool IsDebug = true;
#if (!DEBUG)
IsDebug = false;
#endif
- :
@if(Model.IsDebug)
{
}
else
{
}
ViewBag/ViewData , .
UPDATE:
, :
BaseController, Controller.
public abstract class BaseController : Controller
{
...
protected BaseController()
{
bool indebug = false;
#if DEBUG
indebug = true;
#endif
ViewBag.InDebug = indebug;
}
}
, Controller.
_Layout.cshtml :
@if (ViewBag.InDebug)
{
}
else
{
}
, .