Ejemplo n.º 1
0
 public static byte[] ToByteArray(RpcPacketHeader header)
 {
     byte[] buffer = new byte[Size];
     IntPtr structPtr = Marshal.AllocHGlobal(Size);
     Marshal.StructureToPtr(header, structPtr, true);
     Marshal.Copy(structPtr, buffer, 0, Size);
     Marshal.FreeHGlobal(structPtr);
     return buffer;
 }
Ejemplo n.º 2
0
        public static byte[] ToByteArray(RpcPacketHeader header)
        {
            byte[] buffer    = new byte[Size];
            IntPtr structPtr = Marshal.AllocHGlobal(Size);

            Marshal.StructureToPtr(header, structPtr, true);
            Marshal.Copy(structPtr, buffer, 0, Size);
            Marshal.FreeHGlobal(structPtr);
            return(buffer);
        }