Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NullableComparer.cs
Go to the documentation of this file.
3
5
7[TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
8public sealed class NullableComparer<T> : Comparer<T?> where T : struct, IComparable<T>
9{
10 public override int Compare(T? x, T? y)
11 {
12 if (x.HasValue)
13 {
14 if (y.HasValue)
15 {
16 return x.value.CompareTo(y.value);
17 }
18 return 1;
19 }
20 if (y.HasValue)
21 {
22 return -1;
23 }
24 return 0;
25 }
26
27 public override bool Equals([NotNullWhen(true)] object? obj)
28 {
29 if (obj != null)
30 {
31 return GetType() == obj.GetType();
32 }
33 return false;
34 }
35
36 public override int GetHashCode()
37 {
38 return GetType().GetHashCode();
39 }
40}
override bool Equals([NotNullWhen(true)] object? obj)