- The following example contains a portion of the source code from an application that uses the <see cref="T:System.Globalization.SortVersion" /> class to ensure that the native names of <see cref="T:System.Globalization.RegionInfo" /> objects are ordered appropriately for the current system and current culture. It uses the <see cref="T:System.IO.BinaryReader" /> and <see cref="T:System.IO.BinaryWriter" /> objects to store and retrieve ordered data from a data file named `Regions.dat` rather than retrieving and ordering data each time the application is run. The example first checks to determine whether the data file exists. If it does not, it creates the data and sets the `reindex` flag, which indicates that the data must be resorted and saved again. Otherwise, it retrieves the data and compares the saved <see cref="T:System.Globalization.SortVersion" /> object with the <see cref="T:System.Globalization.SortVersion" /> object for the current culture on the current system. If they are not equal, or if the `reindex` flag had been set previously, it resorts to the <see cref="T:System.Globalization.RegionInfo" /> data.
0 commit comments