CodeAttributeArgument クラス
アセンブリ: System (system.dll 内)

<SerializableAttribute> _ <ComVisibleAttribute(True)> _ <ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ Public Class CodeAttributeArgument
[SerializableAttribute] [ComVisibleAttribute(true)] [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] public class CodeAttributeArgument
[SerializableAttribute] [ComVisibleAttribute(true)] [ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] public ref class CodeAttributeArgument

CodeAttributeArgument を使用して、属性コンストラクタの単一の引数の値か、または属性のプロパティを初期化する値を表すことができます。
Value プロパティは、引数の値を示します。Name プロパティは (使用されている場合)、値を代入する属性のプロパティの名前を示します。
属性宣言は、多くの場合、実行時に属性のコンストラクタに渡されるいくつかの引数によって初期化されます。属性のコンストラクタに引数を渡すには、それぞれの引数に対応する CodeAttributeArgument を CodeAttributeDeclaration の Arguments コレクションに追加します。初期化する必要があるのは、各 CodeAttributeArgument の Value プロパティだけです。コレクション内の引数の順序は、属性のコンストラクタのメソッド シグネチャにある引数の順序に対応している必要があります。
設定するプロパティの名前を示す CodeAttributeArgument をそのプロパティに設定する値と共に提供することで、コンストラクタを通じて利用できない属性のプロパティを設定することもできます。

クラスを作成し、コード属性を追加して、クラスがシリアル化でき、今後使用しないことを宣言するコードを次に示します。
// Declare a new type called Class1. CodeTypeDeclaration class1 = new CodeTypeDeclaration("Class1"); // Use attributes to mark the class as serializable and obsolete. CodeAttributeDeclaration codeAttrDecl = new CodeAttributeDeclaration( "System.Serializable"); class1.CustomAttributes.Add(codeAttrDecl); CodeAttributeArgument codeAttr = new CodeAttributeArgument( new CodePrimitiveExpression("This class is obsolete.")); codeAttrDecl = new CodeAttributeDeclaration("System.Obsolete", codeAttr); class1.CustomAttributes.Add(codeAttrDecl); // A C# code generator produces the following source code for the preceeding example code: // [System.Serializable()] // [System.Obsolete("This class is obsolete.")] // public class Class1 { // }
' Declare a new type called Class1. Dim class1 As New CodeTypeDeclaration("Class1") ' Use attributes to mark the class as serializable and obsolete. Dim codeAttrDecl As New CodeAttributeDeclaration("System.Serializable") class1.CustomAttributes.Add(codeAttrDecl) Dim codeAttr As New CodeAttributeArgument( _ new CodePrimitiveExpression("This class is obsolete.")) codeAttrDecl = New CodeAttributeDeclaration("System.Obsolete", codeAttr) class1.CustomAttributes.Add(codeAttrDecl) ' A Visual Basic code generator produces the following source code for the preceeding example code: ' <System.Serializable(), _ ' System.Obsolete("This class is obsolete.")> _ ' Public Class Class1 ' End Class

System.CodeDom.CodeAttributeArgument


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CodeAttributeArgument メンバ
System.CodeDom 名前空間
CodeAttributeDeclaration
CodeAttributeArgumentCollection
CodeAttributeArgument コンストラクタ ()
アセンブリ: System (system.dll 内)


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CodeAttributeArgument コンストラクタ (CodeExpression)
アセンブリ: System (system.dll 内)


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CodeAttributeArgument コンストラクタ (String, CodeExpression)
アセンブリ: System (system.dll 内)

Dim name As String Dim value As CodeExpression Dim instance As New CodeAttributeArgument(name, value)

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CodeAttributeArgument コンストラクタ

名前 | 説明 |
---|---|
CodeAttributeArgument () | CodeAttributeArgument クラスの新しいインスタンスを初期化します。 |
CodeAttributeArgument (CodeExpression) | 値を指定して、CodeAttributeArgument クラスの新しいインスタンスを初期化します。 |
CodeAttributeArgument (String, CodeExpression) | 名前と値を指定して、CodeAttributeArgument クラスの新しいインスタンスを初期化します。 |

CodeAttributeArgument プロパティ


関連項目
CodeAttributeArgument クラスSystem.CodeDom 名前空間
CodeAttributeDeclaration
CodeAttributeArgumentCollection
CodeAttributeArgument メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

関連項目
CodeAttributeArgument クラスSystem.CodeDom 名前空間
CodeAttributeDeclaration
CodeAttributeArgumentCollection
CodeAttributeArgument メンバ
CodeAttributeArgument データ型で公開されるメンバを以下の表に示します。



名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

関連項目
CodeAttributeArgument クラスSystem.CodeDom 名前空間
CodeAttributeDeclaration
CodeAttributeArgumentCollection
- CodeAttributeArgumentのページへのリンク