int nSizeOfPerson = Marshal.SizeOf(person);
IntPtr intPtr = Marshal.AllocHGlobal(nSizeOfPerson);
// 通过函数对intPtr的地址空间写入数据
...............
//将数据从托管对象封送到非托管内存块,该内存块开始地址为intPtr
Marshal.StructureToPtr(person, intPtr, true);
//将数据从非托管内存块封送到新分配的指定类型的托管对象anotherPerson(指针还原到对象)
PERSON anotherPerson = (PERSON)Marshal.PtrToStructure(intPtr, typeof(PERSON));
代码引用于 http://blog.csdn.net/livelylittlefish/article/details/2423764