Class ParameterOverrides
A convenience form of ParameterOverride that lets you specify multiple parameter overrides in one shot rather than having to construct multiple objects.
Implements
Inherited Members
Namespace: Unity.Resolution
Assembly: Unity.Abstractions.dll
Syntax
public class ParameterOverrides : IEnumerable
Methods
| Improve this Doc View SourceAdd(String, Object)
Add a new override to the collection with the given key and value.
Declaration
public void Add(string key, object value)
Parameters
Type | Name | Description |
---|---|---|
String | key | Key - for example, a parameter or property name. |
Object | value | InjectionParameterValue - the value to be returned by the override. |
GetEnumerator()
Declaration
public IEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator |
OnType(Type)
Wrap this resolver in one that verifies the type of the object being built. This allows you to narrow any override down to a specific type easily.
Declaration
public ResolverOverride[] OnType(Type targetType)
Parameters
Type | Name | Description |
---|---|---|
Type | targetType | Type to constrain the override to. |
Returns
Type | Description |
---|---|
ResolverOverride[] | The new override. |
OnType<T>()
Wrap this resolver in one that verifies the type of the object being built. This allows you to narrow any override down to a specific type easily.
Declaration
public ResolverOverride[] OnType<T>()
Returns
Type | Description |
---|---|
ResolverOverride[] | The new override. |
Type Parameters
Name | Description |
---|---|
T | Type to constrain the override to. |