Skip to content

Commit

Permalink
CA1860 Prefer Count to Any()
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnmbond committed Jan 3, 2025
1 parent 3510e0a commit 9bf9ca7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion PanoramicData.Blazor/Models/Selection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public override string ToString()
return "(All)";
}

if (Items.Any())
if (Items.Count != 0)
{
return string.Join(", ", Items.Select(x => x?.ToString() ?? "").ToArray());
}
Expand Down
2 changes: 1 addition & 1 deletion PanoramicData.Blazor/PDColumn.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ private class FilterKeyVisitor(Expression parameter) : ExpressionVisitor
if (node != null)
{
var chain = node.MemberClauses().ToList();
if (chain.Any() && chain.First().Expression == parameter)
if (chain.Count != 0 && chain.First().Expression == parameter)
{
FilterKey = string.Join(".", chain.Select(
mexpr => mexpr.Member.GetCustomAttribute<FilterKeyAttribute>()?.Value
Expand Down
2 changes: 1 addition & 1 deletion PanoramicData.Blazor/PDFileExplorer.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ private async Task OnAllUploadsReady(UploadsReadyEventArgs args)
Payload = args.Files.Select(x => new FileExplorerItem { State = x.Key, Path = $"{x.Path?.TrimEnd('/')}/{x.Name?.TrimStart('/')}" }).ToList()
};
await GetUploadConflictsAsync(moveCopyArgs).ConfigureAwait(true);
if (moveCopyArgs.Conflicts.Any())
if (moveCopyArgs.Conflicts.Count != 0)
{
var result = await PromptUserForConflictResolution(moveCopyArgs.Conflicts.Select(x => x.Path).ToArray(), true, false).ConfigureAwait(true);
if (result == ConflictResolutions.Cancel)
Expand Down
2 changes: 1 addition & 1 deletion PanoramicData.Blazor/PDList.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private async Task OnSelectionUpdatedAsync()
{
// save (All) token or individual ids
var state = Selection.AllSelected ? Constants.TokenAll : string.Empty;
if (!Selection.AllSelected && Selection.Items.Any())
if (!Selection.AllSelected && Selection.Items.Count != 0)
{
state = ItemKeyFunction != null
? string.Join(",", Selection.Items.Select(x => ItemKeyFunction(x).ToString()).ToArray())
Expand Down

0 comments on commit 9bf9ca7

Please sign in to comment.