Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros
Comparer.cs
Go to the documentation of this file.
2
4
6[TypeDependency("System.Collections.Generic.ObjectComparer`1")]
7[TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
8public abstract class Comparer<T> : IComparer, IComparer<T>
9{
15
16
18 {
19 if (comparison == null)
20 {
21 throw new ArgumentNullException("comparison");
22 }
24 }
25
26 public abstract int Compare(T? x, T? y);
27
28 int IComparer.Compare(object x, object y)
29 {
30 if (x == null)
31 {
32 if (y != null)
33 {
34 return -1;
35 }
36 return 0;
37 }
38 if (y == null)
39 {
40 return 1;
41 }
42 if (x is T && y is T)
43 {
44 return Compare((T)x, (T)y);
45 }
46 ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArgumentForComparison);
47 return 0;
48 }
49}
static object CreateDefaultComparer(Type type)
static Comparer< T > Create(Comparison< T > comparison)
Definition Comparer.cs:17
static Comparer< T > Default
Definition Comparer.cs:11
static void ThrowArgumentException(ExceptionResource resource)