C # when calling WInAPI function, you may see the following statement
1 [StructLayout(LayoutKind.Sequential)] 2 public struct RECT 3 { 4 public int Left; 5 public int Top; 6 public int Right; 7 public int Bottom; 8 }
In front of the belt structure or class
[StructLayout(LayoutKind.Sequential)]
StructLayoutAttribute characteristic effect you are allowed to control the physical layout of the data field structure or class memory.
When we use the normal class or structure the code in C #, the need to use this feature. However, the interaction unmanaged code, required to control the characteristic StructLayoutAttribute unmanaged type layout.
StructLayoutAttribute constructor is used:
StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind)
System.Runtime.InteropServices.LayoutKind is an enumeration type, there are three values.
LayoutKind.Sequential: Forced order of display members arranged in its