DependencyAttribute(String, LoadHint) コンストラクター

定義

指定した LoadHint 値を使用して、DependencyAttribute クラスの新しいインスタンスを初期化します。

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 値のいずれか 1 つ。

次の例では、ネイティブ イメージ生成サービスが常に にバインドされ、 に 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 、依存関係にバインドする厳密な方法に関する共通言語ランタイム ヒントを提供します。 ランタイムは、これらのヒントを使用して、遅延依存関係の読み込みと依存関係への効率的なバインドのトレードオフを解決するのに役立ちます。 たとえば、ハード バインディングを使用すると、ランタイムは依存するネイティブ イメージへのポインターをエンコードできるため、ワーキング セットが減少します。 この属性は、これらの決定を行う際にランタイムをガイドします。

適用対象