There are lots of articles and tutorials on internet about marshaling. for example this one:
http://www.c-sharpcorner.com/UploadFile/GemingLeader/617/[
^]
Marshaling is the process of translating managed memory into native memory (or native memory to managed memory) so that .NET applications can exchange data with native applications.
Your function
StructureToByte
converts a managed structure into a byte array. This byte array can then be sent to a native DLL for example. You can send the managed structure directly to the native DLL because it resides in managed memory (not accessible from native code).