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

◆ IsDefined() [4/8]

static bool System.Attribute.IsDefined ( MemberInfo element,
Type attributeType,
bool inherit )
inlinestaticinherited

Definition at line 389 of file Attribute.cs.

390 {
391 if (element == null)
392 {
393 throw new ArgumentNullException("element");
394 }
395 if (attributeType == null)
396 {
397 throw new ArgumentNullException("attributeType");
398 }
399 if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
400 {
401 throw new ArgumentException(SR.Argument_MustHaveAttributeBaseClass);
402 }
403 return element.MemberType switch
404 {
405 MemberTypes.Property => InternalIsDefined((PropertyInfo)element, attributeType, inherit),
406 MemberTypes.Event => InternalIsDefined((EventInfo)element, attributeType, inherit),
407 _ => element.IsDefined(attributeType, inherit),
408 };
409 }
static bool InternalIsDefined(PropertyInfo element, Type attributeType, bool inherit)
Definition Attribute.cs:43
bool IsDefined(Type attributeType, bool inherit)

References System.SR.Argument_MustHaveAttributeBaseClass, System.Attribute.InternalIsDefined(), System.Reflection.MemberInfo.IsDefined(), and System.Type.IsSubclassOf().