DependencyAttribute(String, LoadHint) Costruttore

Definizione

Inizializza una nuova istanza della DependencyAttribute classe con il valore specificato LoadHint .

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)

Parametri

dependentAssemblyArgument
String

Assembly dipendente a cui eseguire l'associazione.

loadHintArgument
LoadHint

Uno dei LoadHint valori.

Esempio

Nell'esempio seguente viene specificato che il servizio di generazione di immagini native viene sempre associato a AssemblyA e a volte viene associato a 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

Commenti

L'attributo DependencyAttribute fornisce agli hint di Common Language Runtime su quanto strettamente eseguire l'associazione alla dipendenza. Il runtime usa questi hint per risolvere i compromessi tra il carico delle dipendenze differita e l'associazione efficiente alla dipendenza. Ad esempio, il binding rigido consente al runtime di codificare i puntatori alle immagini native dipendenti, che comportano una riduzione del working set. Questo attributo guida il runtime nel prendere queste decisioni.

Si applica a