Open
Description
Analyzer
Diagnostic ID: CA1860
Describe the improvement
An interface such as IReadOnlyList<> inherits its Count
property from IReadOnlyCollection<>.
I believe it makes sense for the CA1860 diagnostic to apply to these types as well?
Describe suggestions on how to achieve the rule
Update the HasEligible*Property
methods to also inspect AllInterfaces
/ BaseType
s, similar to the UseCountProperly analyzer.
Additional context
namespace Test;
public class Class1 {
public void Foo() {
IReadOnlyList<int> list = [];
IReadOnlyCollection<int> collection = list;
if( list.Any() || collection.Any() ) {
return;
}
}
}