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í, na které se má svázat.

loadHintArgument
LoadHint

Jedna z LoadHint hodnot.

Příklady

Následující příklad určuje, že nativní služba generování imagí vždy sváže AssemblyA a někdy sváže 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 rady modulu clr jazyka ClR (Common Language Runtime) o tom, jak úzce se má svázat s závislostí. 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á vazba například umožňuje modulu runtime kódovat ukazatele na závislé nativní image, což vede ke snížení pracovní sady. Tento atribut provede modul runtime při provádění těchto rozhodnutí.

Platí pro