NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

20.1.20 The StructLayout attribute

The StructLayout attribute is used to specify the layout of fields for the struct.

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
public class StructLayoutAttribute: System.Attribute
{
    public StructLayoutAttribute(LayoutKind kind) {…}
    public CharSet CharSet;
    public int Pack;
    public LayoutKind StructLayoutKind { get {…} }
}

The StructLayout attribute has the following behaviors:

If LayoutKind.Explicit is specified, then every field in the struct must have the StructOffset attribute. If LayoutKind.Explicit is not specified, then use of the StructOffset attribute is prohibited.