Edit
What seems to be causing the bool? is Foo?.Any() . If you do not want to compare it with true , I would suggest you have a temporary variable:
bool? any = Foo?.Any(); if (any.Value) ...
Alternatively, if the object is a class, you can use FirstOrDefault() != null as a validation condition. This will not take much time, because it will receive only the first object:
if (Foot?.FirstOrDefault() != null)...
I will use a temporary variable or parameter Foo?.Any() == true .
Original
Note. To my surprise, if (a?.Any()) cannot follow .Value() or .Value (!).
I think you need Value (property) without () (method):
if (Foo?.Any()?.Value) ...
bool? has a .Value (property), which is a bool .
source share