dotnet / dotnet/roslynator

RCS1077 with temporary variable

Open
#683 0 comments 0 reactions 0 assignees View on GitHub
Area-Analyzers Feature Request
Dominant language
C#
Stars
3.5k
Forks
294
Avg merge
2h 30m
Merged PRs (30d)
4

Description

**Product and Version Used**: v2.9.0

`RCS1077: Optimize LINQ method call` is not applied in some cases, i.e. when a variable could be inlined.

**Code with Diagnostic**:
```csharp
int count = enumerable.Count();
if (count == 0)
{
return null;
}
```

**Code with Fix**:
```csharp
if (!enumerable.Any())
{
return null;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.