Use DEFAULT instead of INSTANCE or static field

Matches other similar comparers.
This commit is contained in:
Dean Herbert 2024-02-21 21:02:20 +08:00
parent 929858226a
commit fb593470d5
No known key found for this signature in database
3 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@ namespace osu.Game.Benchmarks
public void OrdinalIgnoreCase() => compare(StringComparer.OrdinalIgnoreCase); public void OrdinalIgnoreCase() => compare(StringComparer.OrdinalIgnoreCase);
[Benchmark] [Benchmark]
public void OrdinalSortByCase() => compare(OrdinalSortByCaseStringComparer.INSTANCE); public void OrdinalSortByCase() => compare(OrdinalSortByCaseStringComparer.DEFAULT);
[Benchmark] [Benchmark]
public void InvariantCulture() => compare(StringComparer.InvariantCulture); public void InvariantCulture() => compare(StringComparer.InvariantCulture);

View File

@ -68,19 +68,19 @@ namespace osu.Game.Screens.Select.Carousel
{ {
default: default:
case SortMode.Artist: case SortMode.Artist:
comparison = OrdinalSortByCaseStringComparer.INSTANCE.Compare(BeatmapSet.Metadata.Artist, otherSet.BeatmapSet.Metadata.Artist); comparison = OrdinalSortByCaseStringComparer.DEFAULT.Compare(BeatmapSet.Metadata.Artist, otherSet.BeatmapSet.Metadata.Artist);
break; break;
case SortMode.Title: case SortMode.Title:
comparison = OrdinalSortByCaseStringComparer.INSTANCE.Compare(BeatmapSet.Metadata.Title, otherSet.BeatmapSet.Metadata.Title); comparison = OrdinalSortByCaseStringComparer.DEFAULT.Compare(BeatmapSet.Metadata.Title, otherSet.BeatmapSet.Metadata.Title);
break; break;
case SortMode.Author: case SortMode.Author:
comparison = OrdinalSortByCaseStringComparer.INSTANCE.Compare(BeatmapSet.Metadata.Author.Username, otherSet.BeatmapSet.Metadata.Author.Username); comparison = OrdinalSortByCaseStringComparer.DEFAULT.Compare(BeatmapSet.Metadata.Author.Username, otherSet.BeatmapSet.Metadata.Author.Username);
break; break;
case SortMode.Source: case SortMode.Source:
comparison = OrdinalSortByCaseStringComparer.INSTANCE.Compare(BeatmapSet.Metadata.Source, otherSet.BeatmapSet.Metadata.Source); comparison = OrdinalSortByCaseStringComparer.DEFAULT.Compare(BeatmapSet.Metadata.Source, otherSet.BeatmapSet.Metadata.Source);
break; break;
case SortMode.DateAdded: case SortMode.DateAdded:

View File

@ -32,7 +32,7 @@ namespace osu.Game.Utils
/// </example> /// </example>
public class OrdinalSortByCaseStringComparer : IComparer<string> public class OrdinalSortByCaseStringComparer : IComparer<string>
{ {
public static readonly OrdinalSortByCaseStringComparer INSTANCE = new OrdinalSortByCaseStringComparer(); public static readonly OrdinalSortByCaseStringComparer DEFAULT = new OrdinalSortByCaseStringComparer();
private OrdinalSortByCaseStringComparer() private OrdinalSortByCaseStringComparer()
{ {