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

◆ Equals()

override bool System.ValueType.Equals ( [NotNullWhen(true)] object? obj)
inline

Definition at line 12 of file ValueType.cs.

13 {
14 if (obj == null)
15 {
16 return false;
17 }
18 Type type = GetType();
19 Type type2 = obj.GetType();
20 if (type2 != type)
21 {
22 return false;
23 }
24 if (CanCompareBits(this))
25 {
26 return FastEqualsCheck(this, obj);
27 }
28 FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
29 for (int i = 0; i < fields.Length; i++)
30 {
31 object value = fields[i].GetValue(this);
32 object value2 = fields[i].GetValue(obj);
33 if (value == null)
34 {
35 if (value2 != null)
36 {
37 return false;
38 }
39 }
40 else if (!value.Equals(value2))
41 {
42 return false;
43 }
44 }
45 return true;
46 }
object? GetValue(object? obj)
static bool FastEqualsCheck(object a, object b)
static bool CanCompareBits(object obj)

References System.ValueType.CanCompareBits(), System.ValueType.FastEqualsCheck(), System.Type.GetType(), System.Reflection.FieldInfo.GetValue(), System.obj, System.type, and System.value.