public IReadOnlyCollection <Type> GetTypesAssignableTo(Type type, TypeResolveStrategy strategy) { var types = ( from a in AppDomain.CurrentDomain.GetAssemblies() where !a.IsDynamic from t in GetExportedTypesSafe(a) where type.IsAssignableFrom(t) && !t.IsAbstract && !t.ContainsGenericParameters && strategy(t) select t ).ToArray(); return(types); }
public IReadOnlyCollection <Type> GetTypesAssignableTo(Type type, TypeResolveStrategy strategy) { return(types); }
/// <summary> /// Gets all types that are assignable to the provided <paramref name="type"/>. /// </summary> /// <param name="type">The <see cref="Type"/> that returned types should be assignable to.</param> /// <param name="strategy">A <see cref="TypeResolveStrategy"/> that should be used when retrieving types.</param> /// <returns>An <see cref="IReadOnlyCollection{T}"/> of <see cref="Type"/> instances.</returns> public IReadOnlyCollection<Type> GetTypesAssignableTo(Type type, TypeResolveStrategy strategy) { return this.cache.GetOrAdd(type, t => this.GetTypesAssignableTo(type)).Where(strategy.Invoke).ToArray(); }
/// <summary> /// Gets all types that are assignable to the provided <paramref name="type" />. /// </summary> /// <param name="type">The <see cref="T:System.Type" /> that returned types should be assignable to.</param> /// <param name="strategy">A <see cref="T:Nancy.TypeResolveStrategy" /> that should be used when retrieving types.</param> /// <returns>An <see cref="T:System.Collections.Generic.IReadOnlyCollection`1" /> of <see cref="T:System.Type" /> instances.</returns> public IReadOnlyCollection <Type> GetTypesAssignableTo(Type type, TypeResolveStrategy strategy) { return(cache.GetOrAdd(type, t => GetTypesAssignableTo(type)) .Where(strategy.Invoke).ToArray()); }
/// <summary> /// Gets all types that are assignable to the provided <typeparamref name="TType"/>. /// </summary> /// <param name="typeCatalog">The <see cref="ITypeCatalog"/> instance where the types should be retrieved from.</param> /// <param name="strategy">A <see cref="TypeResolveStrategy"/> that should be used then retrieving types.</param> /// <typeparam name="TType">The <see cref="Type"/> that returned types should be assignable to.</typeparam> /// <returns>An <see cref="IReadOnlyCollection{T}"/> of <see cref="Type"/> instances.</returns> public static IReadOnlyCollection <Type> GetTypesAssignableTo <TType>(this ITypeCatalog typeCatalog, TypeResolveStrategy strategy) { return(typeCatalog.GetTypesAssignableTo(typeof(TType), strategy)); }