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

◆ GetCustomAttributes() [8/16]

static Attribute[] System.Attribute.GetCustomAttributes ( MemberInfo element,
Type attributeType,
bool inherit )
inlinestaticinherited

Definition at line 343 of file Attribute.cs.

344 {
345 if (element == null)
346 {
347 throw new ArgumentNullException("element");
348 }
349 if (attributeType == null)
350 {
351 throw new ArgumentNullException("attributeType");
352 }
353 if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
354 {
355 throw new ArgumentException(SR.Argument_MustHaveAttributeBaseClass);
356 }
357 return element.MemberType switch
358 {
359 MemberTypes.Property => InternalGetCustomAttributes((PropertyInfo)element, attributeType, inherit),
360 MemberTypes.Event => InternalGetCustomAttributes((EventInfo)element, attributeType, inherit),
361 _ => element.GetCustomAttributes(attributeType, inherit) as Attribute[],
362 };
363 }
static Attribute[] InternalGetCustomAttributes(PropertyInfo element, Type type, bool inherit)
Definition Attribute.cs:15
object[] GetCustomAttributes(bool inherit)

References System.SR.Argument_MustHaveAttributeBaseClass, System.Reflection.MemberInfo.GetCustomAttributes(), System.Attribute.InternalGetCustomAttributes(), and System.Type.IsSubclassOf().