Microsoft.Protocols.TestSuites.Common.RopCreateMessageRequest.Serialize C# (CSharp) Method

Serialize() public method

Serialize the ROP request buffer.
public Serialize ( ) : byte[]
return byte[]
        public byte[] Serialize()
        {
            byte[] resultBytes = new byte[Marshal.SizeOf(this)];
            IntPtr ptr = new IntPtr();
            ptr = Marshal.AllocHGlobal(Marshal.SizeOf(this));
            try
            {
                Marshal.StructureToPtr(this, ptr, true);
                Marshal.Copy(ptr, resultBytes, 0, Marshal.SizeOf(this));
                return resultBytes;
            }
            finally
            {
                Marshal.FreeHGlobal(ptr);
            }
        }
RopCreateMessageRequest