Marshalling means different at various places, mostly it refers to the process of converting the information from one format to another for transferring that to the other entity or for transferring that over the network.
Marshaling is the act of taking data from the environment you are in and
Exporting it to another environment. In the context of .NET, marshalling
Refers to moving data outside of the app-domain you are in, somewhere else.
When you work with unmanaged code, you are marshaling data from your
Managed app-domain to the unmanaged realm. Also, when transferring data
Between app-domains (to another application, on the same or another
Machine), you are also marshaling data from your app-domain, to another
App-domain.
One form of marshaling. As people said, marshaling is serializing
or transforming types over the wire or some boundary. COM had marshaling
when you went out of one apartment into a non-compatible apartment or across
the wire to another machine. When dealing with COM Interop, .NET uses
Interop Marshaling between COM data types and .NET CLR types.
Unmanaged code is simply all code pre .NET. It is all code NOT compiled to
operate under .NET's runtime, the CLR. Unmanaged code is code compiled and
linked natively and has no knowledge of the CLR. Unmanaged code can be
native C++ with pointers, or C, or VB 6, or Delphi, etc. It is everything
not managed by the CLR. In the CLR, code is compiled into IL + metadata into
assemblies and then those assemblies are JITed into assembly language
instructions while called. It is the metadata throughout that allows managed
code to be managed, managed by the CLR. The CLR can control the type
definitions and boundaries (enforce CTS type definitions), control memory
through automatic management of data via the garbage collector, and provide
CAS security among other benefits. So a class is managed code IF compiled
with a .NET compiler and controlled by the CLR whereas "other code is
unmanaged" because it is compiled without a .NET compiler and uses the
unmanaged heap for memory and knows nothing of the CLR.