Register Collection
VContainer supports automatically resolving particular types implicitly to support special relationships.
Duplicate registered interfaces can be resolved together with IEnumerable<T> or IReadOnlyList<T>.
builder.Register<IDisposable, A>(Lifetime.Scoped);
builder.Register<IDisposable, B>(Lifetime.Scoped);
class ClassA
{
public ClassA(IEnumerable<IDisposable> disposables) { /* ... */ }
}
OR
class ClassA
{
public ClassA(IReadOnlyList<IDisposable> disposables) { /* ... */ }
}
注記
This is mainly used by internal functions such as the ITickable marker, etc.