@inherits Custom.Hybrid.Razor14
@using ToSic.Razor.Blade;
@using System.Linq;
<!-- unimportant stuff, hidden -->
<div @Sys.PageParts.InfoWrapper()>
@Html.Partial("../shared/DefaultInfoSection.cshtml")
<div @Sys.PageParts.InfoIntro()>
<h2><code>Count()</code> and <code>Count</code></h2>
<p>Count some stuff.</p>
@*
note to tutorial designers, in v14 it's still an IEnumerable, not IList, so it needs Count()
*@
@* <p>
All list of items in 2sxc are technically <code>List<...></code> objects.
This means they have the property <code>Count</code> (without brackets<code>()</code>).
</p> *@
</div>
</div>
@{
var persons = AsList(App.Data["Persons"]);
var books = AsList(App.Data["Books"]);
}
<ol>
<li>
All Persons: @persons.Count()
</li>
<li>
All Books: @books.Count()
</li>
<li>
Books with Illustrators: @books.Where(b => (b.Illustrators.Count > 0).Count())
</li>
</ol>
@* Footer *@
@Html.Partial("../Shared/Layout/FooterWithSource.cshtml", new { Sys = Sys })