mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-19 02:24:35 +08:00
21 lines
555 B
C#
21 lines
555 B
C#
![]() |
#if UNITY_EDITOR
|
|||
|
using System;
|
|||
|
using System.Reflection;
|
|||
|
|
|||
|
namespace DCFApixels.DragonECS.Unity.Internal
|
|||
|
{
|
|||
|
internal static class ReflectionExtensions
|
|||
|
{
|
|||
|
public static bool TryGetAttribute<T>(this MemberInfo self, out T attrbiute) where T : Attribute
|
|||
|
{
|
|||
|
attrbiute = self.GetCustomAttribute<T>();
|
|||
|
return attrbiute != null;
|
|||
|
}
|
|||
|
public static bool HasAttribute<T>(this MemberInfo self) where T : Attribute
|
|||
|
{
|
|||
|
return self.GetCustomAttribute<T>() != null;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endif
|