Fixed: Do not use Count/LongCount when Any can be used

pull/2/head
Qstick 4 years ago
parent 0198c7a3b1
commit 295b975046

@ -192,8 +192,6 @@ dotnet_diagnostic.CA1823.severity = suggestion
dotnet_diagnostic.CA1824.severity = suggestion
dotnet_diagnostic.CA1825.severity = suggestion
dotnet_diagnostic.CA1826.severity = suggestion
dotnet_diagnostic.CA1827.severity = suggestion
dotnet_diagnostic.CA1828.severity = suggestion
dotnet_diagnostic.CA2000.severity = suggestion
dotnet_diagnostic.CA2002.severity = suggestion
dotnet_diagnostic.CA2007.severity = suggestion

@ -16,7 +16,7 @@ namespace NzbDrone.Common.OAuth
{
var parameters = this.Where(p => p.Name.Equals(name));
if (parameters.Count() == 0)
if (!parameters.Any())
{
return null;
}

@ -205,7 +205,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
}
}
if (fanarts.Count() > 0)
if (fanarts.Any())
{
var fanartElement = new XElement("fanart");
foreach (var fanart in fanarts)

@ -23,7 +23,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
var ptpIndexerOldSettings = ptpIndexers
.Where(i => (i.Settings as PassThePopcornSettings).APIUser.IsNullOrWhiteSpace()).Select(i => i.Name);
if (ptpIndexerOldSettings.Count() > 0)
if (ptpIndexerOldSettings.Any())
{
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("PtpOldSettingsCheckMessage"), string.Join(", ", ptpIndexerOldSettings)));
}

@ -316,7 +316,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
}
}
if (groupedTrackedDownload.Select(c => c.ImportResult).Count(c => c.Result == ImportResultType.Imported) >= 1)
if (groupedTrackedDownload.Select(c => c.ImportResult).Any(c => c.Result == ImportResultType.Imported))
{
trackedDownload.State = TrackedDownloadState.Imported;
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, importMovie.Id));

Loading…
Cancel
Save