TypeBuilder.DefineUninitializedData Method (String, Int32, FieldAttributes)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

member DefineUninitializedData : 
        name:string *
        size:int *
        attributes:FieldAttributes -> FieldBuilder

Parameters

name
Type: System.String

The name used to refer to the data. name cannot contain embedded nulls.

size
Type: System.Int32

The size of the data field.

attributes
Type: System.Reflection.FieldAttributes

The attributes for the field.

Return Value

Type: System.Reflection.Emit.FieldBuilder

A field to reference the data.

Exception Condition
ArgumentException

Length of name is zero.

-or-

size is less than or equal to zero, or greater than or equal to 0x003f0000.

ArgumentNullException

name is null.

InvalidOperationException

The type was previously created using CreateType.

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

The following code sample demonstrates the use of DefineUninitializedData to create an uninitialized data field in a dynamic type:

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Return to top
Show: