Open sandboxFocus

Method WithServices

WithServices(IEnumerable<TBase>?, bool)

Returns a new ServiceProvider<TBase> where some given services have been added to the current ServiceProvider<TBase>. If some of the new services are already present in the current ServiceProvider<TBase>, they are replaced in the new ServiceProvider<TBase>.

Declaration
public ServiceProvider<TBase> WithServices(IEnumerable<TBase>? services, bool disableCaching = false)
Parameters
Type Name Description
IEnumerable<TBase> services
bool disableCaching
Returns
Type Description
ServiceProvider<TBase>

WithServices(TBase, TBase, params TBase[])

Returns a new ServiceProvider<TBase> where some given services have been added to the current ServiceProvider<TBase>. If some of the new services are already present in the current ServiceProvider<TBase>, they are replaced in the new ServiceProvider<TBase>.

Declaration
public ServiceProvider<TBase> WithServices(TBase service1, TBase service2, params TBase[] otherServices)
Parameters
Type Name Description
TBase service1
TBase service2
TBase[] otherServices
Returns
Type Description
ServiceProvider<TBase>