Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RequiredAttribute.cs
Go to the documentation of this file.
2
3[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
5{
6 public bool AllowEmptyStrings { get; set; }
7
9 : base(() => System.SR.RequiredAttribute_ValidationError)
10 {
11 }
12
13 public override bool IsValid(object? value)
14 {
15 if (value == null)
16 {
17 return false;
18 }
19 if (!AllowEmptyStrings && value is string value2)
20 {
21 return !string.IsNullOrWhiteSpace(value2);
22 }
23 return true;
24 }
25}
Definition SR.cs:7