Click or drag to resize
DigitalRuneServiceContainerRegister Method (Type, String, Type)
Registers the specified service type.

Namespace: DigitalRune.ServiceLocation
Assembly: DigitalRune.ServiceLocation (in DigitalRune.ServiceLocation.dll) Version: 1.3.0.0 (1.3.0.13596)
Syntax
public void Register(
	Type serviceType,
	string key,
	Type instanceType
)

Parameters

serviceType
Type: SystemType
The type of the service.
key
Type: SystemString
The name under which the object should be registered. Can be or empty.
instanceType
Type: SystemType
The type implementing the service.
Exceptions
ExceptionCondition
ArgumentNullExceptionserviceType or instanceType is .
ArgumentException The instanceType is not compatible with the serviceType.
Remarks
The service instance will be shared by the container and all child containers (creation policy Shared) and will be automatically disposed when the container is disposed (disposal policy Automatic).
Remarks

If a service with the same type and name is already registered, the existing entry will be replaced.

See Also