<PackageReference Include="NUnit" Version="3.10.0" />

MemberInfoExtensions

public static class MemberInfoExtensions
Extensions to the various MemberInfo derived classes
using System.Collections.Generic; using System.Linq; using System.Reflection; namespace NUnit.Compatibility { public static class MemberInfoExtensions { public static IEnumerable<T> GetAttributes<T>(this MemberInfo info, bool inherit) where T : class { return info.GetCustomAttributes(inherit).OfType<T>(); } public static IEnumerable<T> GetAttributes<T>(this ParameterInfo info, bool inherit) where T : class { return info.GetCustomAttributes(inherit).OfType<T>(); } public static IEnumerable<T> GetAttributes<T>(this Assembly asm) where T : class { return asm.GetCustomAttributes(false).OfType<T>(); } } }