Specifies the layout of fields in a class or struct for interoperability with unmanaged code.
[structlayout( kind, Pack=pack, CharSet=charset, CheckFastMarshal=checkfastmarshal )]
Class and struct declarations.
structlayout is a single-use attribute. structlayout is an alias for System.InterOp.StructLayoutAttribute.
If kind is Layout.Sequential, successive members are assigned increasing offsets such that no members overlap, with padding inserted as necessary to satisfy the packing size constraint.
If kind is Layout.Union, all members are assigned offset 0. Union members cannot contain reference types.
If kind is Layout.Explicit, every field must have the structoffset attribute; otherwise, use of structoffset is prohibited.
The following PDH_RAW_COUNTER struct exactly matches the Platform SDK PDH_RAW_COUNTER data structure.
[structlayout(LayoutKind.Sequential, pack=8)] public struct PDH_RAW_COUNTER { public int CStatus; public FILETIME TimeStamp; public long FirstValue; public long SecondValue; public int MultiCount; } [structlayout(LayoutKind.Sequential, pack=4)] public struct FILETIME { public int dwLow; public int dwHigh; }