Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
DependencyAttribute Class
Collapse the table of content
Expand the table of content

DependencyAttribute Class

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

Namespace:  Microsoft.Practices.Unity
Assembly:  Microsoft.Practices.Unity (in Microsoft.Practices.Unity.dll)

[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Parameter, AllowMultiple = false, 
	Inherited = true)]
public sealed class DependencyAttribute : DependencyResolutionAttribute

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.
© 2015 Microsoft