CA1860 should be reported for derived types as well
Open
Area-Microsoft.CodeAnalysis.NetAnalyzers
untriaged
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
`PreferLengthCountIsEmptyOverAnyAnalyzer` reports [CA1860](https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/quality-rules/ca1860) error only if the type itself has `IsEmpty`/`Count`/`Length` property, and the error is not reported for a type that is derived from another type with one of those properties, e.g. a custom collection type.
For example:
```cs
public class CustomList : List { }
public class Test
{
public void M()
{
// CA1860 is not reported
_ = new CustomList().Any();
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.