Skip to content

Prefer IsEmpty over Count #33801

@terrajobst

Description

@terrajobst

Find places where a concurrent collection's Count is accessed and compared to 0, then replace with IsEmpty. We should probably not special case concurrent collections but rather say if a type defines both Count and IsEmpty, callers should prefer IsEmpty when comparing count to 0.

Category: Performance

Metadata

Metadata

Assignees

Labels

api-approvedAPI was approved in API review, it can be implementedarea-System.Collectionscode-analyzerMarks an issue that suggests a Roslyn analyzercode-fixerMarks an issue that suggests a Roslyn code fixer

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions