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.
pull/5493/head
Qstick 2 years ago
parent 08ee2f7e32
commit b2c2c79a96

@ -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

@ -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)

Loading…
Cancel
Save