Returns all concrete types that are located in the supplied assemblies
and implement or inherit from the supplied TService and match the specified
options...
Namespace: SimpleInjector
Assembly: SimpleInjector (in SimpleInjector.dll) Version: 5.3.0
Syntax
public IEnumerable<Type> GetTypesToRegister<TService>( IEnumerable<Assembly> assemblies, TypesToRegisterOptions options )
Parameters
- assemblies
- Type: System.Collections.GenericIEnumerableAssembly
A list of assemblies that will be searched. - options
- Type: SimpleInjectorTypesToRegisterOptions
The options.
Type Parameters
- TService
- The base type or interface to find derived types for.
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 assemblies = new[] { typeof(FileLogger).Assembly }; var options = new TypesToRegisterOptions { IncludeGenericTypeDefinitions: true }; var types = container.GetTypesToRegister<ILogger>(assemblies, options) .Where(t => t.IsPublic); container.Collection.Register<ILogger>(types);
See Also