DependencyAttribute(String, LoadHint) 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 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
바인딩할 종속 어셈블리입니다.
예제
다음 예제에서는 네이티브 이미지 생성 서비스가 항상 바인딩 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 종속성에 얼마나 긴밀하게 바인딩할 수 있는지에 대한 공용 언어 런타임 힌트를 제공합니다. 런타임은 이러한 힌트를 사용하여 지연 종속성 부하와 종속성에 대한 효율적인 바인딩 간의 절충을 해결하는 데 도움이 됩니다. 예를 들어 하드 바인딩을 사용하면 런타임에서 종속 네이티브 이미지에 대한 포인터를 인코딩할 수 있으므로 작업 집합이 줄어듭니다. 이 특성은 런타임에서 이러한 결정을 내리는 데 안내합니다.