RuntimeInfrastructure mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.Attribute System.AttributeUsage(System.AttributeTargets.Field, Inherited=false) System.Runtime.InteropServices.ComVisible(true)

Indicates the physical position of a field within the unmanaged representation of a class or structure.

The target objects for this attribute are non-static fields of classes and structures qualified with the set to . All non-static fields within an object with an explicit layout are required to have this attribute. No static or constant fields within an object with explicit layout are allowed to have this attribute.

The physical layout of the data members of a class or structure is automatically arranged in managed memory. When a managed object is passed as an argument to unmanaged code, the system creates its unmanaged representation. provides explicit control over this unmanaged representation. indicates the offset of a target data member within the unmanaged representation of a class or structure.

If instances on target fields of an exported object are set to overlap each other, one field is overwritten by another field. For example, if an integer field has the set to 4, and another integer field has the set to 6, the last two bytes of the unmanaged representation of the first integer overlap the first two bytes of the second integer. In such a situation writing to one of the fields might corrupt the data in the other.

See the class overview for an example that uses .

Compilers are required to not preserve this type in metadata as a custom attribute. Instead, compilers are required to emit it directly in the file format, as described in Partition II of the CLI Specification. Metadata consumers, such as the Reflection API, are required to retrieve this data from the file format and return it as if it were a custom attribute.

- Constructor
  A that specifies the offset in bytes from the beginning of the structure to the beginning of the field.

  Constructs and initializes a new instance of the class with the specified field offset in the class or structure.

  If is negative, its value is interpreted as an unsigned value, and the system behavior is implementation-defined.

  The property of the new instance is initialized to .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Property
  System.Int32

  Gets the offset from the beginning of the exported data object to the beginning of the target field.

  A containing the offset from the beginning of the exported data object to the beginning of the target field.

  This property is read-only.

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
0