This documentation is archived and is not being maintained.

SortKey Class

Represents the result of mapping a string to its sort key.

For a list of all members of this type, see SortKey Members.


[Visual Basic]
Public Class SortKey
public class SortKey
public __gc class SortKey
class SortKey

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Each character in a string is given several categories of sort weights, including script, alphabetic, case, and diacritic weights. A sort key serves as the repository of these weights for a particular string. For example, a sort key might contain a string of alphabetic weights, followed by a string of case weights, and so on. SortKey is equivalent to the Windows API method LCMapString with the LCMAP_SORTKEY flag. However, unlike LCMapString, the sort keys for English characters precede the sort keys for Korean characters.

CompareInfo.GetSortKey returns an object of this type. If a security decision depends on a string comparison or a case-change operation, use CompareInfo.GetSortKey of the InvariantCulture to ensure that the behavior will be consistent regardless of the culture settings of the system.


Namespace: System.Globalization

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Mscorlib (in Mscorlib.dll)

See Also

SortKey Members | System.Globalization Namespace | CompareInfo.GetSortKey