The way I understand marshaling is that it provides you with the ability to transfer data sequentially in various operating environments.
In the context of marshaling data from managed unmanaged code, this is more or less the same.
I have some data, like an array of integers or any data type of my choice, and I want to make it available for use in my C # code after my C ++ code performs some operations on it.
I can't just say, “Hey, this is where the array is, do what you want,” for C # code. An array of ints in C ++ may not be stored in the same way as in C #. Marshaling allows you to transfer this data in a manner that is independent of the environment so that both sides see the data equally accurately.
Another example is online. Usually you do not call it marshaling, but if you want to transmit it over the network, you should usually transmit it in such a way that the one who receives it interprets the data in the same way as you. Your computer might present the data in a small end order, and the other might represent it in ascending order.
tl; dr: Marshaling gives you the ability to sequentially present data in various operating environments
Mike Bailey Apr 08 2018-11-21T00: 00Z
source share