This documentation is archived and is not being maintained.

TypeBuilder.DefineInitializedData Method

Defines initialized data field in the .sdata section of the portable executable (PE) file.

[Visual Basic]
Public Function DefineInitializedData( _
   ByVal name As String, _
   ByVal data() As Byte, _
   ByVal attributes As FieldAttributes _
) As FieldBuilder
public FieldBuilder DefineInitializedData(
 string name,
 byte[] data,
 FieldAttributes attributes
public: FieldBuilder* DefineInitializedData(
 String* name,
 unsigned char data __gc[],
 FieldAttributes attributes
public function DefineInitializedData(
   name : String,
 data : Byte[],
 attributes : FieldAttributes
) : FieldBuilder;


The name used to refer to the data. name cannot contain embedded nulls.
The blob of data.
The attributes for the field.

Return Value

A field to reference the data.


Exception Type Condition
ArgumentException Length of name is zero.


The size of the data is less than or equal to zero or greater than or equal to 0x3f0000.

ArgumentNullException name or data is a null reference (Nothing in Visual Basic).
InvalidOperationException CreateType has been previously called.


The field that you create with this method will be static (Shared in Visual Basic), even if you do not include FieldAttributes.Static in the attributes parameter.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

TypeBuilder Class | TypeBuilder Members | System.Reflection.Emit Namespace