Type.StructLayoutAttribute Property
.NET Framework (current version)
Gets a StructLayoutAttribute that describes the layout of the current type.
Assembly: mscorlib (in mscorlib.dll)
abstract StructLayoutAttribute : StructLayoutAttribute with get override StructLayoutAttribute : StructLayoutAttribute with get
Property Value
Type: System.Runtime.InteropServices.StructLayoutAttributeGets a StructLayoutAttribute that describes the gross layout features of the current type.
| Exception | Condition |
|---|---|
| NotSupportedException | The invoked method is not supported in the base class. |
StructLayoutAttribute is not returned by the GetCustomAttributes method. Instead, use this property to get it.
The following code example first defines a class, a structure, and a structure with special layout attributes (the structures are nested within the class). The example then uses the StructLayoutAttribute property to obtain a StructLayoutAttribute for each type, and displays the properties of the attributes.
.NET Framework
Available since 2.0
Available since 2.0
Show: