Class OptionalDependencyAttribute
An DependencyResolutionAttribute used to mark a dependency as optional - the container will try to resolve it, and return null if the resolution fails rather than throw.
Inherited Members
Namespace: Unity
Assembly: Unity.Abstractions.dll
Syntax
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
public sealed class OptionalDependencyAttribute : DependencyResolutionAttribute
Constructors
| Improve this Doc View SourceOptionalDependencyAttribute()
Construct a new OptionalDependencyAttribute object.
Declaration
public OptionalDependencyAttribute()
OptionalDependencyAttribute(String)
Construct a new OptionalDependencyAttribute object that specifies a named dependency.
Declaration
public OptionalDependencyAttribute(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the dependency. |