diff --git a/Il2CppInspector/Reflection/MemberInfo.cs b/Il2CppInspector/Reflection/MemberInfo.cs index 3960783..f22d838 100644 --- a/Il2CppInspector/Reflection/MemberInfo.cs +++ b/Il2CppInspector/Reflection/MemberInfo.cs @@ -5,6 +5,7 @@ */ using System.Collections.Generic; +using System.Linq; using System.Reflection; namespace Il2CppInspector.Reflection { @@ -16,6 +17,8 @@ namespace Il2CppInspector.Reflection { // Custom attributes for this member public abstract IEnumerable CustomAttributes { get; } + public TypeInfo[] GetCustomAttributes(string fullTypeName) => CustomAttributes.Where(a => a.AttributeType.FullName == fullTypeName).Select(x => x.AttributeType).ToArray(); + // Type that this type is declared in for nested types protected int declaringTypeDefinitionIndex { private get; set; } = -1; public TypeInfo DeclaringType => declaringTypeDefinitionIndex != -1? Assembly.Model.TypesByDefinitionIndex[declaringTypeDefinitionIndex] : null;