Code inspection: Replace with FirstOrDefault($args$)
This inspection reports a conditional expression that checks Any(...) before calling First(...), and returns default(T) when there is no match. That pattern is equivalent to FirstOrDefault(...).
Example
var result = items.Any(x => x.IsValid) ? items.First(x => x.IsValid) : default(MyType);
var result = items.FirstOrDefault(x => x.IsValid);
Quick-fix
Replace the Any(...) ? First(...) : default(T) pattern with FirstOrDefault(...).
29 March 2026