System.ReflectionLibrary.GetTypesWithThisAttribute C# (CSharp) Method

GetTypesWithThisAttribute() public static method

public static GetTypesWithThisAttribute ( Type attribute, bool allowAbstract = false ) : IEnumerable
attribute Type
allowAbstract bool
return IEnumerable
        public static IEnumerable<Type> GetTypesWithThisAttribute(this Type attribute, bool allowAbstract = false)
            =>
            from assembly in AppDomain.CurrentDomain.GetAssemblies()
            from t in assembly.GetTypes()
            where t.IsDefined(attribute, false)
                  && (allowAbstract || (!t.IsAbstract && !t.IsInterface))
            select t;