Class OptionalDependencyAttribute
- Namespace
- Unity
- Assembly
- Unity.Abstractions.dll
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.
[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter)]
public sealed class OptionalDependencyAttribute : DependencyResolutionAttribute
- Inheritance
-
OptionalDependencyAttribute
- Inherited Members
- Extension Methods
Constructors
OptionalDependencyAttribute()
Construct a new OptionalDependencyAttribute object.
public OptionalDependencyAttribute()
OptionalDependencyAttribute(string)
Construct a new OptionalDependencyAttribute object that specifies a named dependency.
public OptionalDependencyAttribute(string name)
Parameters
name
stringName of the dependency.