Share via


LayoutKind Enumeration

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Controls the layout of an object when exported to unmanaged code.

Namespace:  System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Enumeration LayoutKind
[SerializableAttribute]
public enum LayoutKind
[SerializableAttribute]
public enum class LayoutKind
[<SerializableAttribute>]
type LayoutKind
public enum LayoutKind

Members

Member name Description
Sequential The members of the object are laid out sequentially, in the order in which they appear when exported to unmanaged memory. The members are laid out according to the packing specified in StructLayoutAttribute..::..Pack, and can be noncontiguous.
Explicit The precise position of each member of an object in unmanaged memory is explicitly controlled, subject to the setting of the StructLayoutAttribute..::..Pack field. Each member must use the FieldOffsetAttribute to indicate the position of that field within the type.
Auto The runtime automatically chooses an appropriate layout for the members of an object in unmanaged memory. Objects defined with this enumeration member cannot be exposed outside of managed code. Attempting to do so generates an exception.

Remarks

This enumeration is used with StructLayoutAttribute. The common language runtime uses the Auto layout value by default.

See Also

Reference

System.Runtime.InteropServices Namespace