Training
Module
Perform operations on arrays using helper methods in C# - Training
Use C# helper methods to perform reverse, resize, split and join operations on arrays.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This article provides supplementary remarks to the reference documentation for this API.
Through .NET Framework 4, each version of .NET Framework included tables that contained sort weights and data on string normalization and that are based on a particular version of Unicode. In .NET Framework 4.5 and later versions, the presence of these tables depends on the operating system:
Consequently, the result of a string comparison can depend not only on .NET Framework version, but also on the operating system version, as the following table shows. Note that this list of supported Unicode versions applies to character comparison and sorting only; it does not apply to classification of Unicode characters by category.
.NET Framework version | Operating system | Unicode version |
---|---|---|
4 | All operating systems | Unicode 5.0 |
4.5 and later versions | Windows 7 | Unicode 5.0 |
4.5 and later versions | Windows 8 and later versions | Unicode 6.0 |
On Windows 8, because the version of Unicode used in string comparison and ordering depends on the version of the operating system, the results of string comparison may differ even for applications that run on a specific version of .NET Framework.
All versions of .NET (Core) rely on the underlying operating system when performing string comparisons. Therefore, the results of a string comparison or the order in which strings are sorted depends on the version of Unicode used by the operating system when performing the comparison. On Linux, macOS, and Windows 10 and later versions, International Components for Unicode libraries provide the implementation for comparison and sorting APIs.
The SortVersion class provides information about the Unicode version used by .NET for string comparison and ordering. It enables developers to write applications that can detect and successfully handle changes in the version of Unicode that is used to compare and sort an application's strings.
You can instantiate a SortVersion object in two ways:
The SortVersion class has two properties, FullVersion and SortId, that indicate the Unicode version and the specific culture used for string comparison. The FullVersion property is an arbitrary numeric value that reflects the Unicode version used for string comparison, and the SortId property is an arbitrary Guid that reflects the culture whose conventions are used for string comparison. The values of these two properties are important only when you compare two SortVersion objects by using the Equals method, the Equality operator, or the Inequality operator.
You typically use a SortVersion object when saving or retrieving some form of culture-sensitive, ordered string data, such as indexes or the literal strings themselves. This requires the following steps:
When the ordered string data is saved, the FullVersion and SortId property values are also saved.
When the ordered string data is retrieved, you can recreate the SortVersion object used for ordering the strings by calling the SortVersion constructor.
This newly instantiated SortVersion object is compared with a SortVersion object that reflects the culture whose conventions are used to order the string data.
If the two SortVersion objects are not equal, the string data must be reordered.
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Training
Module
Perform operations on arrays using helper methods in C# - Training
Use C# helper methods to perform reverse, resize, split and join operations on arrays.