static void VerfiyByValDateArray() { var structure1 = new StructWithDateArray() { array = new DateTime[] { DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now } }; int size = Marshal.SizeOf(structure1); IntPtr memory = Marshal.AllocHGlobal(size); try { Marshal.StructureToPtr(structure1, memory, false); } finally { Marshal.FreeHGlobal(memory); } }
static void VerfiyByValDateArray() { var structure1 = new StructWithDateArray() { array = new DateTime[] { DateTime.Now, DateTime.Now , DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now , DateTime.Now, DateTime.Now } }; int size = Marshal.SizeOf(structure1); IntPtr memory = Marshal.AllocHGlobal(size); try { Marshal.StructureToPtr(structure1, memory, false); } finally { Marshal.FreeHGlobal(memory); } }