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

◆ IsValid() [1/2]

override bool System.ComponentModel.DataAnnotations.MinLengthAttribute.IsValid ( object? value)
inlinevirtual

Reimplemented from System.ComponentModel.DataAnnotations.ValidationAttribute.

Definition at line 19 of file MinLengthAttribute.cs.

20 {
22 if (value == null)
23 {
24 return true;
25 }
26 int num;
27 if (value is string text)
28 {
29 num = text.Length;
30 }
31 else
32 {
33 if (!CountPropertyHelper.TryGetCount(value, out var count))
34 {
35 throw new InvalidCastException(System.SR.Format(System.SR.LengthAttribute_InvalidValueType, value.GetType()));
36 }
37 num = count;
38 }
39 return num >= Length;
40 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string LengthAttribute_InvalidValueType
Definition SR.cs:68
Definition SR.cs:7

References System.count, System.ComponentModel.DataAnnotations.MinLengthAttribute.EnsureLegalLengths(), System.SR.Format(), System.ComponentModel.DataAnnotations.MinLengthAttribute.Length, System.SR.LengthAttribute_InvalidValueType, System.text, System.ComponentModel.DataAnnotations.CountPropertyHelper.TryGetCount(), and System.value.