Returns all concrete non-generic types that are located in the supplied assemblies
and implement or inherit from the supplied TService.
Namespace: SimpleInjector
Assembly: SimpleInjector (in SimpleInjector.dll) Version: 5.3.0
Syntax
public IEnumerable<Type> GetTypesToRegister<TService>( params Assembly[] assemblies )
Parameters
- assemblies
- Type: System.ReflectionAssembly
A list of assemblies that will be searched.
Type Parameters
- TService
- The base type or interface to find derived types for.
Return Value
Type: IEnumerableTypeA collection of types.
Return Value
Type: IEnumerableTypeA collection of types.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | Thrown when one of the arguments contain a null reference. |
Remarks
C#
var container = new Container(); var types = container.GetTypesToRegister<ILogger>( typeof(ILogger).Assembly, typeof(FileLogger).Assembly) .Where(type => type.IsPublic); container.Collections.Register<ILogger>(types);
See Also