StructLayoutAttribute Class

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

Lets you control the physical layout of the data fields of a class or structure.

System..::..Object
  System..::..Attribute
    System.Runtime.InteropServices..::..StructLayoutAttribute

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

[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct, Inherited = false)]
public sealed class StructLayoutAttribute : Attribute

The StructLayoutAttribute type exposes the following members.

  NameDescription
Public methodStructLayoutAttribute(Int16)Initalizes a new instance of the StructLayoutAttribute class with the specified System.Runtime.InteropServices..::..LayoutKind enumeration member.
Public methodStructLayoutAttribute(LayoutKind)Initalizes a new instance of the StructLayoutAttribute class with the specified System.Runtime.InteropServices..::..LayoutKind enumeration member.
Top

  NameDescription
Public propertyValueGets the LayoutKind value that specifies how the class or structure is arranged.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public fieldCharSetIndicates whether string data fields within the class should be marshaled as LPWSTR or LPSTR by default.
Public fieldPackControls the alignment of data fields of a class or structure in memory.
Public fieldSizeIndicates the absolute size of the class or structure.
Top

You can apply this attribute to classes or structures.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: