Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Compare()

int System.Collections.Comparer.Compare ( object? a,
object? b )
inline

Implements System.Collections.IComparer.

Definition at line 44 of file Comparer.cs.

45 {
46 if (a == b)
47 {
48 return 0;
49 }
50 if (a == null)
51 {
52 return -1;
53 }
54 if (b == null)
55 {
56 return 1;
57 }
58 if (a is string @string && b is string string2)
59 {
60 return _compareInfo.Compare(@string, string2);
61 }
62 if (a is IComparable comparable)
63 {
64 return comparable.CompareTo(b);
65 }
66 if (b is IComparable comparable2)
67 {
68 return -comparable2.CompareTo(a);
69 }
70 throw new ArgumentException(SR.Argument_ImplementIComparable);
71 }
readonly CompareInfo _compareInfo
Definition Comparer.cs:11
int Compare(string? string1, string? string2)

References System.Collections.Comparer._compareInfo, System.SR.Argument_ImplementIComparable, System.comparable, System.Globalization.CompareInfo.Compare(), and System.Runtime.Serialization.Dictionary.