You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The warning "CA1860: Prefer comparing 'Length' to 0 rather than using Any(); both for clarity and for performance" appears. (Note: for a List, the message will show 'Count' instead of 'Length'.)
I do not agree with the message. Using Any() on every collection type gives more consistency than littering you code with Length, Count and Any(). This rule is important voor performance, but not for clarity.
Maybe you disagree with my statement, but that's the point that I'm trying to make: the rule talks about clarity but there are different opinions about that. Because of this I think the message should be something just like:
"CA1860: Prefer comparing 'Length' to 0 rather than using Any() for performance"
(English is not my first language so maybe this could be phrased better than that).
Diagnostic Id:
CA1860
Expected Behavior:
CA1860: Prefer comparing 'Length' to 0 rather than using Any() for performance
Actual Behavior:
CA1860: Prefer comparing 'Length' to 0 rather than using Any(); both for clarity and for performance
The text was updated successfully, but these errors were encountered:
Version Used:
.Net 8
Steps to Reproduce:
I do not agree with the message. Using
Any()
on every collection type gives more consistency than littering you code withLength
,Count
andAny()
. This rule is important voor performance, but not for clarity.Maybe you disagree with my statement, but that's the point that I'm trying to make: the rule talks about clarity but there are different opinions about that. Because of this I think the message should be something just like:
"CA1860: Prefer comparing 'Length' to 0 rather than using Any() for performance"
(English is not my first language so maybe this could be phrased better than that).
Diagnostic Id:
CA1860
Expected Behavior:
CA1860: Prefer comparing 'Length' to 0 rather than using Any() for performance
Actual Behavior:
CA1860: Prefer comparing 'Length' to 0 rather than using Any(); both for clarity and for performance
The text was updated successfully, but these errors were encountered: