PreferLengthCountIsEmptyOverAnyAnalyzer reports 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:
public class CustomList<T> : List<T> { }
public class Test
{
public void M()
{
// CA1860 is not reported
_ = new CustomList<int>().Any();
}
}
PreferLengthCountIsEmptyOverAnyAnalyzerreports CA1860 error only if the type itself hasIsEmpty/Count/Lengthproperty, 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: