mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.5000.0 2.0.0.0 4.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Object System.Runtime.InteropServices.ComVisible(true)

A culture-sensitive comparison of two strings depends on each character in the strings having 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. In particular, the value of a object is its key data, which is a series of bytes that encode the string, culture-specific sorting rules, and user-specified compare options. A comparison using sort keys consists of a bitwise comparison of the corresponding key data in each sort key.

An instance of the class is returned by the method.

## Performance Considerations

When performing a string comparison, the and methods yield the same results.

In effect, the method generates the sort key for each string, performs the comparison, then discards the sort key and returns the result of the comparison. In fact, the method does not generate an entire sort key and then perform the comparison. Instead, the method generates the key data for each text element, that is, base character, surrogate pair, or combining character sequence, in each string. The method then compares the key data for the corresponding text elements. The operation terminates as soon as the ultimate result of the comparison is determined. Sort key information is computed, but no object is created. This strategy is economical in terms of performance if both strings are compared once, but becomes expensive if the same strings are compared many times.

The method requires generation of a object for each string before performing the comparison. This strategy is expensive in terms of performance for the first comparison because of the time and memory invested to generate the objects. However, it becomes economical if the same sort keys are compared many times.

For example, suppose you write an application that searches a database table for the row in which the string-based index column matches a specified search string. The table contains thousands of rows, and comparing the search string to the index in each row will take a long time. Therefore, when the application stores a row and its index column, it also generates and stores the sort key for the index in a column dedicated to improving search performance. When the application searches for a target row, it compares the sort key for the search string to the sort key for the index string, instead of comparing the search string to the index string.

## Security Considerations

The method returns a object with the value based on a specified string and value, and the culture associated with the underlying object. If a security decision depends on a string comparison or case change, the application should use the method of the invariant culture to ensure that the behavior of the operation is consistent, regardless of the culture settings of the operating system.

The application should use the following steps to obtain the method:

Use the property to obtain the invariant culture.

Use the property of the invariant culture to obtain a object.

Use the method of the object.

Working with the value of a object is equivalent to calling the Windows API LCMapString method with the LCMAP_SORTKEY value specified. However, for the SortKey object, the sort keys for English characters precede the sort keys for Korean characters.

objects can be serialized, but only so that they can cross objects. If an application serializes a object, the application must regenerate all of the sort keys when there is a new version of the .NET Framework.

For more information about sort keys, see Unicode Technical Standard #10, "Unicode Collation Algorithm" at the Unicode home page.

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

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` ``

  The method compares the properties of the and parameters. The method yields the same results as the method.

  Compares two sort keys.

  A signed integer that indicates the relationship between and .

  Value

  Condition

  Less than zero

  is less than .

  Zero

  is equal to .

  Greater than zero

  is greater than .

  The first sort key to compare. The second sort key to compare.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  Two objects are considered equal if their properties are equal.

  This method overrides .

  Determines whether the specified object is equal to the current object.

  true if the parameter is equal to the current object; otherwise, false.

  The object to compare with the current object.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  This method generates the same hash code for two objects that are equal according to the method.

  This method overrides .

  Serves as a hash function for the current object that is suitable for hashing algorithms and data structures such as a hash table.

  A hash code for the current object.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Byte[] To be added: an object of type 'byte []' To be added

  Gets the byte array representing the current object.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String To be added: an object of type 'string' To be added

  Gets the original string used to create the current object.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

  The return value is the concatenation of the string "SortKey - ", the culture identifier and compare options of the current object, and the value of the property.

  This method overrides .

  Returns a string that represents the current object.

  A string that represents the current object.