mirror of
https://github.com/status-im/nft-faucet.git
synced 2025-02-23 12:08:32 +00:00
15 lines
408 B
C#
15 lines
408 B
C#
using System.Reflection;
|
|
|
|
namespace NftFaucet.Extensions;
|
|
|
|
public static class TypeExtensions
|
|
{
|
|
public static TAttribute GetAttribute<TAttribute>(this MemberInfo memberInfo)
|
|
where TAttribute : Attribute
|
|
{
|
|
var customAttributes = memberInfo?.GetCustomAttributes(false);
|
|
var attribute = customAttributes?.OfType<TAttribute>().SingleOrDefault();
|
|
return attribute;
|
|
}
|
|
}
|