From b2c2c79a96e2a4e71e8f95b3a38975387dda50c1 Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 9 Jan 2023 21:49:23 -0600 Subject: [PATCH] Don't compare strings to Empty using Equals Comparing strings using the String.Length property or the String.IsNullOrEmpty method is faster than using Equals. This is because Equals executes significantly more MSIL instructions than either IsNullOrEmpty or the number of instructions executed to retrieve the Length property value and compare it to zero. --- .editorconfig | 1 - .../Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 15f6b66d0..2afbdde32 100644 --- a/.editorconfig +++ b/.editorconfig @@ -191,7 +191,6 @@ dotnet_diagnostic.CA1814.severity = suggestion dotnet_diagnostic.CA1815.severity = suggestion dotnet_diagnostic.CA1816.severity = suggestion dotnet_diagnostic.CA1819.severity = suggestion -dotnet_diagnostic.CA1820.severity = suggestion dotnet_diagnostic.CA1822.severity = suggestion dotnet_diagnostic.CA1823.severity = suggestion dotnet_diagnostic.CA1824.severity = suggestion diff --git a/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs b/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs index 993f7a526..afc3cb0d7 100644 --- a/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs +++ b/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs @@ -239,7 +239,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc xmlResult += "https://www.thetvdb.com/?tab=series&id=" + series.TvdbId; } - return xmlResult == string.Empty ? null : new MetadataFileResult("tvshow.nfo", xmlResult); + return xmlResult.IsNullOrWhiteSpace() ? null : new MetadataFileResult("tvshow.nfo", xmlResult); } public override MetadataFileResult EpisodeMetadata(Series series, EpisodeFile episodeFile)