次の方法で共有


TypeBuilder.DefineInitializedData メソッド

移植可能な実行可能 (PE) ファイルの .sdata セクションの初期化済みデータ フィールドを定義します。

Public Function DefineInitializedData( _
   ByVal name As String, _   ByVal data() As Byte, _   ByVal attributes As FieldAttributes _) As FieldBuilder
[C#]
public FieldBuilder DefineInitializedData(stringname,byte[] data,FieldAttributesattributes);
[C++]
public: FieldBuilder* DefineInitializedData(String* name,unsigned chardata __gc[],FieldAttributesattributes);
[JScript]
public function DefineInitializedData(
   name : String,data : Byte[],attributes : FieldAttributes) : FieldBuilder;

パラメータ

  • name
    データを参照するために使用される名前。name に null を埋め込むことはできません。
  • data
    データの BLOB。
  • attributes
    フィールドの属性。

戻り値

データを参照するフィールド。

例外

例外の種類 条件
ArgumentException name の長さが 0 です。

または

データのサイズが 0 以下か、0x3f0000 以上です。

ArgumentNullException name または data が null 参照 (Visual Basic では Nothing) です。
InvalidOperationException CreateType は既に呼び出されています。

解説

attributes パラメータに FieldAttributes.Static を含めなかった場合でも、このメソッドを使用して作成するフィールドは静的なフィールド (Visual Basic の場合は Shared) になります。

必要条件

プラットフォーム: 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 名前空間