Src/Black.Beard.ComponentModel/ComponentModel/TypeDiscovery.cs
/// <summary>
/// return a list of type that assignable from the specified type
/// </summary>
/// <param name="typeFilter"></param>
/// <returns></returns>
return a list of type that assignable from the specified type
return a list of type that assignable from the specified type
public List<Type> GetTypesWithAttributes(Type baseType, Type typeFilter)
        {
            if (baseType == null)
                baseType = typeof(object);
            if (typeFilter == null)
                typeFilter = typeof(Attribute);
            var result = new List<Type>();
            var assemblies = Assemblies().ToArray();
            result.AddRange(Collect(type =>
            {
                return baseType.IsAssignableFrom(type)
                        && ToList(TypeDescriptor.GetAttributes(type)).Any(c => c.GetType() == typeFilter);
            }, assemblies));
            return result;
        }
public List < Type > GetTypesWithAttributes ( Type baseType , Type typeFilter ) { if ( baseType == null ) baseType = typeof ( object ) ; if ( typeFilter == null ) typeFilter = typeof ( Attribute ) ; var result = new List < Type > ( ) ; var assemblies = Assemblies ( ) . ToArray ( ) ; result . AddRange ( Collect ( type => { return baseType . IsAssignableFrom ( type ) && ToList ( TypeDescriptor . GetAttributes ( type ) ) . Any ( c => c . GetType ( ) == typeFilter ) ; } , assemblies ) ) ; return result ; }
return a list of type that assignable from the specified type
return a list of type that assignable from the specified type
None
baseType
Type
typeFilter
Type
None