Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DisplayNameAttribute.cs
Go to the documentation of this file.
2
4
5[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event)]
7{
8 public static readonly DisplayNameAttribute Default = new DisplayNameAttribute();
9
10 public virtual string DisplayName => DisplayNameValue;
11
12 protected string DisplayNameValue { get; set; }
13
15 : this(string.Empty)
16 {
17 }
18
19 public DisplayNameAttribute(string displayName)
20 {
21 DisplayNameValue = displayName;
22 }
23
24 public override bool Equals([NotNullWhen(true)] object? obj)
25 {
26 if (obj is DisplayNameAttribute displayNameAttribute)
27 {
28 return displayNameAttribute.DisplayName == DisplayName;
29 }
30 return false;
31 }
32
33 public override int GetHashCode()
34 {
35 return DisplayName?.GetHashCode() ?? 0;
36 }
37
38 public override bool IsDefaultAttribute()
39 {
40 return Equals(Default);
41 }
42}
static readonly DisplayNameAttribute Default
override bool Equals([NotNullWhen(true)] object? obj)