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.
This commit is contained in:
Qstick 2023-01-09 21:49:23 -06:00
parent 08ee2f7e32
commit b2c2c79a96
2 changed files with 1 additions and 2 deletions

View File

@ -191,7 +191,6 @@ dotnet_diagnostic.CA1814.severity = suggestion
dotnet_diagnostic.CA1815.severity = suggestion dotnet_diagnostic.CA1815.severity = suggestion
dotnet_diagnostic.CA1816.severity = suggestion dotnet_diagnostic.CA1816.severity = suggestion
dotnet_diagnostic.CA1819.severity = suggestion dotnet_diagnostic.CA1819.severity = suggestion
dotnet_diagnostic.CA1820.severity = suggestion
dotnet_diagnostic.CA1822.severity = suggestion dotnet_diagnostic.CA1822.severity = suggestion
dotnet_diagnostic.CA1823.severity = suggestion dotnet_diagnostic.CA1823.severity = suggestion
dotnet_diagnostic.CA1824.severity = suggestion dotnet_diagnostic.CA1824.severity = suggestion

View File

@ -239,7 +239,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
xmlResult += "https://www.thetvdb.com/?tab=series&id=" + series.TvdbId; 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) public override MetadataFileResult EpisodeMetadata(Series series, EpisodeFile episodeFile)