Table of Contents

Class DependencyAttribute

Namespace
Unity
Assembly
Unity.Abstractions.dll

This attribute is used to mark properties and parameters as targets for injection.

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter)]
public sealed class DependencyAttribute : DependencyResolutionAttribute
Inheritance
DependencyAttribute
Inherited Members
Extension Methods

Remarks

For properties, this attribute is necessary for injection to happen. For parameters, it's not needed unless you want to specify additional information to control how the parameter is resolved.

Constructors

DependencyAttribute()

Create an instance of DependencyAttribute with no name.

public DependencyAttribute()

DependencyAttribute(string)

Create an instance of DependencyAttribute with the given name.

public DependencyAttribute(string name)

Parameters

name string

Name to use when resolving this dependency.