This documentation is archived and is not being maintained.

DependencyAttribute Constructor

Note: This constructor is new in the .NET Framework version 2.0.

Initializes a new instance of the DependencyAttribute class with the specified LoadHint value.

Namespace: System.Runtime.CompilerServices
Assembly: mscorlib (in mscorlib.dll)

public DependencyAttribute (
	string dependentAssemblyArgument,
	LoadHint loadHintArgument
public DependencyAttribute (
	String dependentAssemblyArgument, 
	LoadHint loadHintArgument
public function DependencyAttribute (
	dependentAssemblyArgument : String, 
	loadHintArgument : LoadHint



The dependent assembly to bind to.


One of the LoadHint values.

The DependencyAttribute attribute gives the common language runtime hints on how tightly to bind to the dependency. The runtime uses these hints to help settle tradeoffs between lazy dependency load and efficient binding to the dependency. For example, hard binding allows the runtime to encode pointers to dependent native images, which results in a reduced working set. This attribute guides the runtime in making these decisions.

The following code example specifies that the native image generation service always binds to AssemblyA and sometimes binds to AssemblyB.

using System;
using System.Runtime.CompilerServices;

[assembly: DependencyAttribute("AssemblyA", LoadHint.Always)]
[assembly: DependencyAttribute("AssemblyB", LoadHint.Sometimes)]

class Program
    static void Main(string[] args)

        Console.WriteLine("The DependencyAttribute attribute was applied.");


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0