I can't check if my list length is 0. The code works if I remove the second part of the or; only check if the list is null.
@{
@if( ViewBag.somelist != null || Enumerable.Count(ViewBag.somelist) == 0)
{
<p>list not null or empty</p>
}
@else
{
<p>list is empty</p>
}
}
what I've tried:
- Enumerable.Count(ViewBag.somelist) <1
- ViewBag.somelist.Count() == 0
var somelist=Viewbag.somelist.Count;
@if( ViewBag.bbM9and10 != null || somelist == 0){}
also the interchangables to check if list is empty: >=0, <=0, <1, >=1