DependencyAttribute(String, LoadHint) Konstruktor

Definicja

Inicjuje DependencyAttribute nowe wystąpienie klasy o określonej LoadHint wartości.

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

Zestaw zależny do powiązania.

loadHintArgument
LoadHint

Jedna z LoadHint wartości.

Przykłady

Poniższy przykład określa, że natywna usługa generowania obrazów zawsze wiąże się z AssemblyA usługą i czasami wiąże się z usługą 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

Uwagi

Atrybut DependencyAttribute zapewnia wskazówki dotyczące sposobu ścisłego powiązania zależności ze środowiskiem uruchomieniowym języka wspólnego. Środowisko uruchomieniowe używa tych wskazówek, aby ułatwić rozwiązanie kompromisów między obciążeniem zależności z opóźnieniem i wydajnym powiązaniem z zależnością. Na przykład twarde powiązanie umożliwia środowisku uruchomieniowemu kodowanie wskaźników do zależnych obrazów natywnych, co powoduje zmniejszenie liczby zestawów roboczych. Ten atrybut prowadzi środowisko uruchomieniowe w podejmowaniu tych decyzji.

Dotyczy