#if DISABLE_DEBUG #undef DEBUG #endif using System; using System.Reflection; using System.Runtime.CompilerServices; namespace DCFApixels.DragonECS.AutoInjections.Internal { internal static class ReflectionExtenions { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryGetCustomAttribute(this Type self, out T attribute) where T : Attribute { attribute = self.GetCustomAttribute(); return attribute != null; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryGetCustomAttribute(this MemberInfo self, out T attribute) where T : Attribute { attribute = self.GetCustomAttribute(); return attribute != null; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool HasAttribute(this MemberInfo self) where T : Attribute { return self.GetCustomAttribute() != null; } } }