DependencyAttribute(String, LoadHint) Construtor

Definição

Inicializa uma nova instância da DependencyAttribute classe com o valor especificado 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)

Parâmetros

dependentAssemblyArgument
String

A montagem dependente a que se deve ligar.

loadHintArgument
LoadHint

Um dos LoadHint valores.

Exemplos

O exemplo seguinte especifica que o serviço nativo de geração de imagens se liga sempre a AssemblyA e por vezes se liga 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

Observações

O DependencyAttribute atributo dá à linguagem comum dicas em tempo de execução sobre quão firmemente deve ligar-se à dependência. O runtime utiliza estas dicas para ajudar a resolver compromissos entre carga de dependência preguiçosa e ligação eficiente à dependência. Por exemplo, a ligação rígida permite que o runtime codifique ponteiros para imagens nativas dependentes, o que resulta num conjunto de trabalho reduzido. Este atributo orienta o tempo de execução na tomada destas decisões.

Aplica-se a