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のページへのリンク