ComplexStruct.cs 520 B

123456789101112131415161718
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Runtime.InteropServices;
  4. using System.Text;
  5. namespace SIASUN.Autopilot.Device.BeckHoff
  6. {
  7. [StructLayout(LayoutKind.Sequential, Pack = 1)]
  8. public class ComplexStruct
  9. {
  10. [MarshalAs(UnmanagedType.I1)]
  11. public bool boolVal;
  12. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 6)]
  13. public string stringVal = "";
  14. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
  15. public int[] dintArr = new int[4];
  16. }
  17. }