How do I convert a structure to a byte array in C#?
I have defined a structure like this:
public struct CIFSPacket { public uint protocolIdentifi
Header header = new Header(); Byte[] headerBytes = new Byte[Marshal.SizeOf(header)]; Marshal.Copy((IntPtr)(&header), headerBytes, 0, headerBytes.Length);
This should do the trick quickly, right?