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

pull/5493/head
Qstick 2 years ago
parent 4db10e6283
commit 2b79fe833b

@ -194,7 +194,6 @@ dotnet_diagnostic.CA1819.severity = suggestion
dotnet_diagnostic.CA1822.severity = suggestion
dotnet_diagnostic.CA1823.severity = suggestion
dotnet_diagnostic.CA1824.severity = suggestion
dotnet_diagnostic.CA1847.severity = suggestion
dotnet_diagnostic.CA2000.severity = suggestion
dotnet_diagnostic.CA2002.severity = suggestion
dotnet_diagnostic.CA2007.severity = suggestion

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

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

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

@ -6,12 +6,12 @@
// 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)
{
if (!title.Contains("."))
if (!title.Contains('.'))
{
return false;
}
if (title.Contains(" "))
if (title.Contains(' '))
{
return false;
}

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

Loading…
Cancel
Save