DragonECS-AutoInjections/src/Utils/ReflectionExtensions.cs

15 lines
354 B
C#
Raw Normal View History

2023-06-05 23:45:25 +08:00
using System;
using System.Reflection;
namespace DCFApixels.DragonECS
{
internal static class ReflectionExtensions
{
public static bool TryGetAttribute<T>(this MemberInfo self, out T attribute) where T : Attribute
{
attribute = self.GetCustomAttribute<T>();
return attribute != null;
}
}
}