DependencyAttribute(String, LoadHint) Konstruktor

Definice

Inicializuje novou instanci DependencyAttribute třídy se zadanou LoadHint hodnotou.

public:
 DependencyAttribute(System::String ^ dependentAssemblyArgument, System::Runtime::CompilerServices::LoadHint loadHintArgument);
public DependencyAttribute(string dependentAssemblyArgument, System.Runtime.CompilerServices.LoadHint loadHintArgument);
new System.Runtime.CompilerServices.DependencyAttribute : string * System.Runtime.CompilerServices.LoadHint -> System.Runtime.CompilerServices.DependencyAttribute
Public Sub New (dependentAssemblyArgument As String, loadHintArgument As LoadHint)

Parametry

dependentAssemblyArgument
String

Závislé sestavení, ke které se má svázat.

loadHintArgument
LoadHint

Jedna z LoadHint hodnot.

Příklady

Následující příklad určuje, že služba generování nativní bitové kopie vždy sváže a AssemblyA někdy váže na 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.");
    }
}
Imports System.Runtime.CompilerServices

<Assembly: DependencyAttribute("AssemblyA", LoadHint.Always)> 
<Assembly: DependencyAttribute("AssemblyB", LoadHint.Sometimes)> 
Module Program


    Sub Main(ByVal args() As String)
        Console.WriteLine("The DependencyAttribute attribute was applied.")
    End Sub


End Module

Poznámky

Tento DependencyAttribute atribut poskytuje nápovědu modulu CLR (Common Language Runtime) o tom, jak úzce vytvořit vazbu k závislosti. Modul runtime tyto rady používá k vyrovnání kompromisů mezi opožděnou zátěží závislostí a efektivní vazbou na závislost. Pevné vazby například umožňují modulu runtime kódovat ukazatele na závislé nativní bitové kopie, což vede ke snížení pracovní sady. Tento atribut provede modul runtime při provádění těchto rozhodnutí.

Platí pro