日期:2014-05-20 浏览次数:20805 次
public struct TimeYS { public int Year; public int Month; public int Day; public int Hour; public int Minute; public int Second; } public struct BExtrTypeHrmnCntRt { public TimeYS Tm; [MarshalAs(UnmanagedType.ByValArray, SizeConst=51)] public float[] MxAN; //A相最大含有率 [MarshalAs(UnmanagedType.ByValArray, SizeConst=51)] public TimeYS[] MxTmAN; //A相最大含有率发生时间 [MarshalAs(UnmanagedType.ByValArray, SizeConst=51)] public float[] MnAN; //A相最小含有率 [MarshalAs(UnmanagedType.ByValArray, SizeConst=51)] public TimeYS[] MnTmAN; //A相最小含有率发生时间 [MarshalAs(UnmanagedType.ByValArray, SizeConst=51)] public float[] MxBN; //B相最大含有率 [MarshalAs(UnmanagedType.ByValArray, SizeConst=51)] public TimeYS[] MxTmBN; //B相最大含有率发生时间 [MarshalAs(UnmanagedType.ByValArray, SizeConst=51)] public float[] MnBN; //B相最小含有率 [MarshalAs(UnmanagedType.ByValArray, SizeConst=51)] public TimeYS[] MnTmBN; //B相最小含有率发生时间 [MarshalAs(UnmanagedType.ByValArray, SizeConst=51)] public float[] MxCN; //C相最大含有率 [MarshalAs(UnmanagedType.ByValArray, SizeConst=51)] public TimeYS[] MxTmCN; //C相最大含有率发生时间 [MarshalAs(UnmanagedType.ByValArray, SizeConst=51)] public float[] MnCN; //C相最小含有率 [MarshalAs(UnmanagedType.ByValArray, SizeConst=51)] public TimeYS[] MnTmCN; //C相最小含有率发生时间 }
using System; using System.Collections.Generic; using System.Text; [color=#FF0000]using System.Runtime.InteropServices;[/color] namespace ConsoleApplication1 { public struct TimeYS { public int Year; public int Month; public int Day; public int Hour; public int Minute; public int Second; } public struct BExtrTypeHrmnCntRt { public TimeYS Tm; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public float[] MxAN; //A相最大含有率 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public TimeYS[] MxTmAN; //A相最大含有率发生时间 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public float[] MnAN; //A相最小含有率 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public TimeYS[] MnTmAN; //A相最小含有率发生时间 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public float[] MxBN; //B相最大含有率 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public TimeYS[] MxTmBN; //B相最大含有率发生时间 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public float[] MnBN; //B相最小含有率 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public TimeYS[] MnTmBN; //B相最小含有率发生时间 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public float[] MxCN; //C相最大含有率 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public TimeYS[] MxTmCN; //C相最大含有率发生时间 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public float[] MnCN; //C相最小含有率 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)] public TimeYS[] MnTmCN; //C相最小含有率发生时间 } class Program { static void Main(string[] args) { Console.WriteLine(Marshal.SizeOf(typeof(BExtrTypeHrmnCntRt))); //输出8592 Console.ReadLine(); } } }