|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Microsoft.Extensions.FileSystemGlobbing.Util
{
internal static class StringComparisonHelper
{
public static StringComparer GetStringComparer(StringComparison comparisonType) => comparisonType switch
{
StringComparison.CurrentCulture => StringComparer.CurrentCulture,
StringComparison.CurrentCultureIgnoreCase => StringComparer.CurrentCultureIgnoreCase,
StringComparison.Ordinal => StringComparer.Ordinal,
StringComparison.OrdinalIgnoreCase => StringComparer.OrdinalIgnoreCase,
StringComparison.InvariantCulture => StringComparer.InvariantCulture,
StringComparison.InvariantCultureIgnoreCase => StringComparer.InvariantCultureIgnoreCase,
_ => throw new InvalidOperationException(SR.Format(SR.UnexpectedStringComparisonType, comparisonType))
};
}
}
|