DependencyAttribute クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<SerializableAttribute> _ <AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple:=True)> _ Public NotInheritable Class DependencyAttribute Inherits Attribute
[SerializableAttribute] [AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=true)] public sealed class DependencyAttribute : Attribute
[SerializableAttribute] [AttributeUsageAttribute(AttributeTargets::Assembly, AllowMultiple=true)] public ref class DependencyAttribute sealed : public Attribute

この属性は、ネイティブ アセンブリのイメージを生成するために ネイティブ イメージ ジェネレータ (Ngen.exe) が使用します。
どのような場合に参照元アセンブリが依存関係を読み込むかを指定するには、LoadHint 列挙体の値を使用して DependencyAttribute 属性を依存アセンブリに適用します。
Ngen.exe は、読み込まれる可能性の高い依存関係 (Always) にバインドします。このヒントを使用すると、Ngen.exe は、ワーキング セットを縮小し、スループットを向上するコードを生成できますが、親アセンブリが読み込まれるときに必ず依存関係が読み込まれます。

ネイティブ イメージの生成サービスを常に AssemblyA にバインドし、場合によっては AssemblyB にバインドするように指定するコード例を次に示します。
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
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."); } }

System.Attribute
System.Runtime.CompilerServices.DependencyAttribute


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DependencyAttribute コンストラクタ
アセンブリ: mscorlib (mscorlib.dll 内)

Dim dependentAssemblyArgument As String Dim loadHintArgument As LoadHint Dim instance As New DependencyAttribute(dependentAssemblyArgument, loadHintArgument)
public function DependencyAttribute ( dependentAssemblyArgument : String, loadHintArgument : LoadHint )
- loadHintArgument
LoadHint 値の 1 つ。

DependencyAttribute 属性は、どの程度の密接さで依存関係にバインドするかに関するヒントを共通言語ランタイムに提供します。ランタイムは、このヒントを使用して依存関係にかかるロードとバインディング効率との間のトレードオフの解決に役立てます。たとえば、ハード バインディングすると、ランタイムがポインタを依存ネイティブ イメージにエンコードできるため、ワーキング セットが縮小されます。ランタイムはこの属性に基づいてこのような判断を行います。

ネイティブ イメージの生成サービスを常に AssemblyA にバインドし、場合によっては AssemblyB にバインドするように指定するコード例を次に示します。
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
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."); } }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DependencyAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | DependentAssembly | 依存アセンブリの値を取得します。 |
![]() | LoadHint | どのような場合にアセンブリが依存関係を読み込むかを示す LoadHint 値を取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |

DependencyAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

DependencyAttribute メンバ
どのような場合に参照元アセンブリが依存関係を読み込むかを示します。このクラスは継承できません。
DependencyAttribute データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | DependentAssembly | 依存アセンブリの値を取得します。 |
![]() | LoadHint | どのような場合にアセンブリが依存関係を読み込むかを示す LoadHint 値を取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

- DependencyAttributeのページへのリンク