In the view, I ask, or do not set a specific property ViewBag
- ViewBag.SomeData
. In the _Layout.cshtml
file _Layout.cshtml
I need to output or not output a specific block depending on whether SomeData
is SomeData
in the ViewBag
, and how to do it?
While I use for this ViewData
and its function ContainsKey
, but this is how it ViewBag
in some places in ViewBag
and in others, where you need to know if a property is defined and where not - ViewData
, it’s not very nice to use this and that. Or everywhere it is necessary to switch to ViewData
.