Use Contains(char) instead of Contains(string) for performance

This commit is contained in:
Qstick 2023-01-09 22:24:35 -06:00
parent 4db10e6283
commit 2b79fe833b
6 changed files with 8 additions and 9 deletions

View File

@ -194,7 +194,6 @@ dotnet_diagnostic.CA1819.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
dotnet_diagnostic.CA1847.severity = suggestion
dotnet_diagnostic.CA2000.severity = suggestion dotnet_diagnostic.CA2000.severity = suggestion
dotnet_diagnostic.CA2002.severity = suggestion dotnet_diagnostic.CA2002.severity = suggestion
dotnet_diagnostic.CA2007.severity = suggestion dotnet_diagnostic.CA2007.severity = suggestion

View File

@ -131,7 +131,7 @@ namespace NzbDrone.Common.Extensions
public static string WrapInQuotes(this string text) public static string WrapInQuotes(this string text)
{ {
if (!text.Contains(" ")) if (!text.Contains(' '))
{ {
return text; return text;
} }
@ -240,7 +240,7 @@ namespace NzbDrone.Common.Extensions
public static string ToUrlHost(this string input) public static string ToUrlHost(this string input)
{ {
return input.Contains(":") ? $"[{input}]" : input; return input.Contains(':') ? $"[{input}]" : input;
} }
} }
} }

View File

@ -627,13 +627,13 @@ namespace NzbDrone.Core.Datastore.Migration
try try
{ {
if (audioChannelPositions.Contains("+")) if (audioChannelPositions.Contains('+'))
{ {
return audioChannelPositions.Split('+') return audioChannelPositions.Split('+')
.Sum(s => decimal.Parse(s.Trim(), CultureInfo.InvariantCulture)); .Sum(s => decimal.Parse(s.Trim(), CultureInfo.InvariantCulture));
} }
if (audioChannelPositions.Contains("/")) if (audioChannelPositions.Contains('/'))
{ {
var channelStringList = Regex.Replace(audioChannelPositions, var channelStringList = Regex.Replace(audioChannelPositions,
@"^\d+\sobjects", @"^\d+\sobjects",

View File

@ -133,7 +133,7 @@ namespace NzbDrone.Core.Localization
await CopyInto(dictionary, baseFilenamePath).ConfigureAwait(false); await CopyInto(dictionary, baseFilenamePath).ConfigureAwait(false);
if (culture.Contains("_")) if (culture.Contains('_'))
{ {
var languageBaseFilenamePath = Path.Combine(prefix, GetResourceFilename(culture.Split('_')[0])); var languageBaseFilenamePath = Path.Combine(prefix, GetResourceFilename(culture.Split('_')[0]));
await CopyInto(dictionary, languageBaseFilenamePath).ConfigureAwait(false); await CopyInto(dictionary, languageBaseFilenamePath).ConfigureAwait(false);

View File

@ -6,12 +6,12 @@
// It's better not to use a title that might be scene than to use one that isn't scene // It's better not to use a title that might be scene than to use one that isn't scene
public static bool IsSceneTitle(string title) public static bool IsSceneTitle(string title)
{ {
if (!title.Contains(".")) if (!title.Contains('.'))
{ {
return false; return false;
} }
if (title.Contains(" ")) if (title.Contains(' '))
{ {
return false; return false;
} }

View File

@ -35,7 +35,7 @@ namespace Sonarr.Http.Frontend.Mappers
return !resourceUrl.StartsWith("/content") && return !resourceUrl.StartsWith("/content") &&
!resourceUrl.StartsWith("/mediacover") && !resourceUrl.StartsWith("/mediacover") &&
!resourceUrl.Contains(".") && !resourceUrl.Contains('.') &&
!resourceUrl.StartsWith("/login"); !resourceUrl.StartsWith("/login");
} }
} }