Share via


DependencyAttribute(String, LoadHint) 생성자

정의

지정된 DependencyAttribute 값을 사용하여 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)

매개 변수

dependentAssemblyArgument
String

바인딩할 대상 종속 어셈블리입니다.

loadHintArgument
LoadHint

LoadHint 값 중 하나입니다.

예제

다음 예제에서는 네이티브 이미지 생성 서비스가 항상 에 AssemblyA 바인딩되고 경우에 따라 에 바인딩되도록 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

설명

특성은 DependencyAttribute 종속성에 바인딩하는 방법에 대한 공용 언어 런타임 힌트를 제공합니다. 런타임은 이러한 힌트를 사용하여 지연 종속성 부하와 종속성에 대한 효율적인 바인딩 간의 절충을 해결하는 데 도움이 됩니다. 예를 들어 하드 바인딩을 사용하면 런타임에서 포인터를 종속 네이티브 이미지로 인코딩할 수 있으므로 작업 집합이 줄어듭니다. 이 특성은 이러한 결정을 내리는 런타임을 안내합니다.

적용 대상