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

View File

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

View File

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

View File

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

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
public static bool IsSceneTitle(string title)
{
if (!title.Contains("."))
if (!title.Contains('.'))
{
return false;
}
if (title.Contains(" "))
if (title.Contains(' '))
{
return false;
}

View File

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