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

◆ TryGetCount()

static bool System.ComponentModel.DataAnnotations.CountPropertyHelper.TryGetCount ( object value,
out int count )
inlinestatic

Definition at line 10 of file CountPropertyHelper.cs.

11 {
13 {
14 count = collection.Count;
15 return true;
16 }
17 PropertyInfo runtimeProperty = value.GetType().GetRuntimeProperty("Count");
18 if (runtimeProperty != null && runtimeProperty.CanRead && runtimeProperty.PropertyType == typeof(int))
19 {
20 count = (int)runtimeProperty.GetValue(value);
21 return true;
22 }
23 count = -1;
24 return false;
25 }
object? GetValue(object? obj)

References System.Reflection.PropertyInfo.CanRead, System.collection, System.count, System.Reflection.PropertyInfo.GetValue(), System.Reflection.PropertyInfo.PropertyType, and System.value.

Referenced by System.ComponentModel.DataAnnotations.MaxLengthAttribute.IsValid(), and System.ComponentModel.DataAnnotations.MinLengthAttribute.IsValid().