diff options
Diffstat (limited to 'src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Shims/Reflection.cs')
-rw-r--r-- | src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Shims/Reflection.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Shims/Reflection.cs b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Shims/Reflection.cs index 0cf2d612..d064b2c5 100644 --- a/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Shims/Reflection.cs +++ b/src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Shims/Reflection.cs @@ -263,6 +263,17 @@ namespace System.Reflection #endif } + +#if !NET_4_6 + public static class CustomAttributeExtensions + { + public static T GetCustomAttribute<T>(MemberInfo memberInfo, bool inherit) + { + return (T)memberInfo.GetCustomAttributes(typeof(T), inherit).FirstOrDefault(); + } + } + +#endif } |