Bewerken

Delen via


StringComparer.IsWellKnownOrdinalComparer Method

Definition

Determines whether the specified IEqualityComparer<T> is a well-known ordinal string comparer.

public:
 static bool IsWellKnownOrdinalComparer(System::Collections::Generic::IEqualityComparer<System::String ^> ^ comparer, [Runtime::InteropServices::Out] bool % ignoreCase);
public static bool IsWellKnownOrdinalComparer (System.Collections.Generic.IEqualityComparer<string?>? comparer, out bool ignoreCase);
static member IsWellKnownOrdinalComparer : System.Collections.Generic.IEqualityComparer<string> * bool -> bool
Public Shared Function IsWellKnownOrdinalComparer (comparer As IEqualityComparer(Of String), ByRef ignoreCase As Boolean) As Boolean

Parameters

comparer
IEqualityComparer<String>

The comparer to query.

ignoreCase
Boolean

When this method returns, contains a value stating whether comparer is case-insensitive. Set to false if this method returns false.

Returns

true if comparer is a well-known ordinal string comparer; otherwise, false.

Remarks

A "well-known ordinal comparer" describes a comparer that behaves identically to Ordinal when passed to Dictionary<TKey,TValue> or HashSet<T>. For example, Default is a well-known ordinal comparer because a Dictionary<TKey,TValue> given Default as a constructor argument will behave identically to a Dictionary<TKey,TValue> given Ordinal as a constructor argument. If ignoreCase is true on method exit, then comparer behaves identically to OrdinalIgnoreCase when passed to the constructor of such a collection.

Applies to