TypeBuilder.DefineField メソッド
名前、属性、およびフィールドの種類を指定して、新しいフィールドをクラスに追加します。
Public Function DefineField( _
ByVal fieldName As String, _ ByVal type As Type, _ ByVal attributes As FieldAttributes _) As FieldBuilder
[C#]
public FieldBuilder DefineField(stringfieldName,Typetype,FieldAttributesattributes);
[C++]
public: FieldBuilder* DefineField(String* fieldName,Type* type,FieldAttributesattributes);
[JScript]
public function DefineField(
fieldName : String,type : Type,attributes : FieldAttributes) : FieldBuilder;
パラメータ
- fieldName
フィールドの名前。 fieldName には埋め込み null を含めることができません。 - type
フィールドの型。 - attributes
フィールドの属性。
戻り値
定義されたフィールド。
例外
例外の種類 | 条件 |
---|---|
ArgumentException | fieldName の長さが 0 です。
または type が System.Void です。 または このフィールドの親クラスに合計サイズが指定されています。 |
ArgumentNullException | fieldName が null 参照 (Visual Basic では Nothing) です。 |
InvalidOperationException | この型は、 CreateType TypeBuilder を使用して既に作成されています。 |
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
TypeBuilder クラス | TypeBuilder メンバ | System.Reflection.Emit 名前空間