internal unsafe static void ReadFromStream(Stream stream, out PVSNode ret) { ByteBufferNode node = NetByteArrayPool.GetByteBufferNode(Marshal.SizeOf(typeof(PVSNode))); try { stream.Read(node.Buffer, 0, node.DataSize); PVSNode p; System.IntPtr dstPtr = (System.IntPtr)(&p); Marshal.Copy(node.Buffer, 0, dstPtr, node.DataSize); ret = p; } finally { node.Dispose(); } }