Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/TypeNameInterpretation/FrameworkExtensions/SpanExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Brian Reichle. All Rights Reserved. Licensed under the MIT License. See LICENSE in the project root for license information.

#if !NET
namespace System;

static class SpanExtensions
{
public static bool ContainsAny(this ReadOnlySpan<char> haystack, ReadOnlySpan<char> needle)
=> haystack.IndexOfAny(needle) >= 0;
}
#endif
4 changes: 2 additions & 2 deletions src/TypeNameInterpretation/InsFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static string Format(InsAssembly assembly)
{
ArgumentNullException.ThrowIfNull(assembly);

if (assembly.Qualifications.Length == 0 && assembly.Name.AsSpan().IndexOfAny(Delimiters.All) < 0)
if (assembly.Qualifications.Length == 0 && !assembly.Name.AsSpan().ContainsAny(Delimiters.All))
{
return assembly.Name;
}
Expand Down Expand Up @@ -188,7 +188,7 @@ static void WriteWithEscapedDelimiters(StringBuilder builder, string identifier,
}

static bool RequiresQuoting(string identifier)
=> string.IsNullOrEmpty(identifier) || identifier.AsSpan().IndexOfAny(Delimiters.All) >= 0;
=> string.IsNullOrEmpty(identifier) || identifier.AsSpan().ContainsAny(Delimiters.All);
}

sealed class AssemblyLocator : IInsTypeVisitor<object, InsAssembly?>
Expand Down