Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ReadOnlyAttribute.cs
Go to the documentation of this file.
2
4
5[AttributeUsage(AttributeTargets.All)]
6public sealed class ReadOnlyAttribute : Attribute
7{
8 public static readonly ReadOnlyAttribute Yes = new ReadOnlyAttribute(isReadOnly: true);
9
10 public static readonly ReadOnlyAttribute No = new ReadOnlyAttribute(isReadOnly: false);
11
12 public static readonly ReadOnlyAttribute Default = No;
13
14 public bool IsReadOnly { get; }
15
16 public ReadOnlyAttribute(bool isReadOnly)
17 {
18 IsReadOnly = isReadOnly;
19 }
20
21 public override bool Equals([NotNullWhen(true)] object? value)
22 {
23 if (value is ReadOnlyAttribute readOnlyAttribute)
24 {
25 return readOnlyAttribute.IsReadOnly == IsReadOnly;
26 }
27 return false;
28 }
29
30 public override int GetHashCode()
31 {
32 return base.GetHashCode();
33 }
34
35 public override bool IsDefaultAttribute()
36 {
37 return IsReadOnly == Default.IsReadOnly;
38 }
39}
override bool Equals([NotNullWhen(true)] object? value)
static readonly ReadOnlyAttribute Yes
static readonly ReadOnlyAttribute Default
static readonly ReadOnlyAttribute No