CompareInfo.GetSortKeyLength(ReadOnlySpan<Char>, CompareOptions) Method

Definition

Gets the total number of sort key bytes that would be produced from the specified input.

C#
public int GetSortKeyLength (ReadOnlySpan<char> source, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None);

Parameters

source
ReadOnlySpan<Char>

The text to get the sort key for.

options
CompareOptions

An optional combination of CompareOptions enumeration values to use for computing the sort key. The default value is None.

Returns

The length, in bytes, of the sort key.

Exceptions

options contains an unsupported flag.

-or-

source cannot be processed using the desired CompareOptions under the current CompareInfo.

Applies to

Product Versions
.NET 5, 6, 7, 8, 9