Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[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.
Inheritance Hierarchy
System. . :: . .Object
System. . :: . .Attribute
System.Runtime.InteropServices..::..StructLayoutAttribute
Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Struct, Inherited := False)> _
Public NotInheritable Class StructLayoutAttribute _
Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct, Inherited = false)]
public sealed class StructLayoutAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Struct, Inherited = false)]
public ref class StructLayoutAttribute sealed : public Attribute
[<Sealed>]
[<AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct, Inherited = false)>]
type StructLayoutAttribute =
class
inherit Attribute
end
public final class StructLayoutAttribute extends Attribute
The StructLayoutAttribute type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() |
StructLayoutAttribute(Int16) | Initalizes a new instance of the StructLayoutAttribute class with the specified System.Runtime.InteropServices..::..LayoutKind enumeration member. |
![]() |
StructLayoutAttribute(LayoutKind) | Initalizes a new instance of the StructLayoutAttribute class with the specified System.Runtime.InteropServices..::..LayoutKind enumeration member. |
Top
Properties
Name | Description | |
---|---|---|
![]() |
Value | Gets the LayoutKind value that specifies how the class or structure is arranged. |
Top
Methods
Name | Description | |
---|---|---|
![]() |
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() |
GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Fields
Name | Description | |
---|---|---|
![]() |
CharSet | Indicates whether string data fields within the class should be marshaled as LPWSTR or LPSTR by default. |
![]() |
Pack | Controls the alignment of data fields of a class or structure in memory. |
![]() |
Size | Indicates the absolute size of the class or structure. |
Top
Remarks
You can apply this attribute to classes or structures.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.