Avoid constant arrays as arguments (#14784)

This commit is contained in:
Bond-009
2025-09-12 21:58:28 +02:00
committed by GitHub
parent 8776a447d1
commit 6796b3435d
5 changed files with 26 additions and 21 deletions

View File

@@ -167,12 +167,12 @@ public static class XmlReaderExtensions
// Only split by comma if there is no pipe in the string
// We have to be careful to not split names like Matthew, Jr.
var separator = !value.Contains('|', StringComparison.Ordinal)
ReadOnlySpan<char> separator = !value.Contains('|', StringComparison.Ordinal)
&& !value.Contains(';', StringComparison.Ordinal)
? new[] { ',' }
: new[] { '|', ';' };
? stackalloc[] { ',' }
: stackalloc[] { '|', ';' };
foreach (var part in value.Trim().Trim(separator).Split(separator))
foreach (var part in value.AsSpan().Trim().Trim(separator).ToString().Split(separator))
{
if (!string.IsNullOrWhiteSpace(part))
{