I have the following code:
if (Model.Products?.Cards?.Any())
{
}
If I try this it throws an error:
Cannot convert bool? to bool
Having searched for this this I'm not sure why the error is thrown, where as it will allow me to do
if (Model.Products?.Cards?.Count > 0)
{
}
Why am I unable to use .Any()
in this case - why is it classed as a nullable bool yet the count isn't a nullable int?