Host.AddService Method
Definition
Overloads
AddService(Type, Object) | Adds a service to this Host |
AddService<T>(T) | Adds a service to this Host |
AddService(Type, Object)
Adds a service to this Host
public void AddService (Type serviceType, object serviceObject);
Parameters
- serviceType
- System.Type
The System.Type of a service
- serviceObject
- System.Object
The actual service System.Object itself
Exceptions
System.ArgumentException
Thrown if the service has already been added
System.ArgumentOutOfRangeException
Thrown if serviceType is not an interface
AddService<T>(T)
Adds a service to this Host
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Use AddService(Type serviceType, object serviceObject) instead.")]
public void AddService<T> (T service) where T : class;
Type Parameters
- T
The service type
Parameters
- service
- T
The service System.Object to add
- Attributes
- System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute
Exceptions
System.ArgumentException
Thrown if the service has already been added
System.ArgumentOutOfRangeException
Thrown if T is not an interface