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
Rule S2971 seems like multiple rules folded into one. It would be better to split the rule into multiple ones and re-evaluate.
This way users can enable and disable the parts that are useful to their codebase.
Potential split:
Use OfType instead of using Select with as to typecast elements and then null-checking in a query expression to choose elements based on type.
Use OfType instead of using Where and the is operator, followed by a cast in a Select
Use an expression in Any instead of Where(element => [expression]).Any().
Use Count instead of Count() when it’s available.
Don’t call ToArray() or ToList() in the middle of a query chain.
Rule S2971 seems like multiple rules folded into one. It would be better to split the rule into multiple ones and re-evaluate.
This way users can enable and disable the parts that are useful to their codebase.
Potential split:
OfType
instead of usingSelect
with as to typecast elements and then null-checking in a query expression to choose elements based on type.OfType
instead of usingWhere
and the is operator, followed by a cast in aSelect
Any
instead ofWhere(element => [expression]).Any()
.Count
instead ofCount()
when it’s available.ToArray()
orToList()
in the middle of a query chain.Related community post.
The text was updated successfully, but these errors were encountered: