What are the differences between Marshal by value and
Marshal by reference?

Answers were Sorted based on User's Feedback



What are the differences between Marshal by value and Marshal by reference?..

Answer / rashmi tiwari

Remoting makes an object in one process (the server)
available to code in another process (the client). This is
called marshalling, and there are two fundamentally
different ways to marshal an object

-->Marshal by value: the server creates a copy of the
object passes the copy to the client.
-->Marshal by reference: the client creates a proxy for the
object and then uses the proxy to access the object.

Is This Answer Correct ?    33 Yes 6 No

What are the differences between Marshal by value and Marshal by reference?..

Answer / j's

Marshal-by-value objects are copied by the remoting system
and passed in their entirety to the caller's application
domain. Once copied to the caller's application domain (by
the marshaling process), all method calls and property
accesses are executed entirely within that domain. The
entire object exists in the caller's domain, so there is no
need to marshal accesses across domain boundaries. Using
marshal-by-value objects can increase performance and
reduce network traffic when used for small objects or
objects to which you will be making many accesses. However,
because the object exists entirely in the caller's
application domain, no state changes to the object are
communicated to the originating application domain, or from
the originator back to the caller. Marshal-by-value is not
a good choice for very large objects with many accesses. It
makes little sense to marshal an entire large object across
domain boundaries when all you need is access to a single
field, method, or property.

Is This Answer Correct ?    31 Yes 8 No

What are the differences between Marshal by value and Marshal by reference?..

Answer / bolisettyvaas

MBV:the server creates a value and send it to the Client .
MBR:The Server sends the reference of that value to the Client.

Is This Answer Correct ?    15 Yes 2 No

What are the differences between Marshal by value and Marshal by reference?..

Answer / m.m.suhail

MBV:In this Server Creates a exact Copy of the Object and
sends it to the Client.Which can be used by the Client with
in its AppDomain with out making any further calls to the
server.
But this has a drawback,the copy sent to client will be
static and will not reflect the subsequent changes.So its
better not to use MBV when there are constant updates.

MBR:DotNet Framework creates a Proxy on the Client
AppDomain which the client uses for accessing the Objects
on the Server.We need to extend 'MarshalByRefObject' for
this.
But this to has a drawback,it increases the network traffic
as there can ba number of accesses to the Server.

So its depends upon our requirement.Small objects with
frequent accesses,we can go with MBR and huge Objects with
relatively low accesses we can go with MBV.

Is This Answer Correct ?    15 Yes 4 No

Post New Answer

More Dot Net Remoting Interview Questions

In which conditions do you opt for Remoting services?

8 Answers   Manland, Tech Mahindra,


what is the diff between remoting and webservice

1 Answers  


Can you pass SOAP messages through remoting?

0 Answers  


What are CAO's i.e. Client Activated Objects ?

1 Answers  


Explain how can you automatically generate interface for the remotable object in .net with microsoft tools?

0 Answers  






How can you create a strong name for a .NET assembly?

2 Answers  


How to directly call a native function exported from a dll?

0 Answers  


Explain the difference between the registerwellknownservicetype(), registerwellknownclienttype(), registeractivatedservicetype() and registeractivatedclienttype() in .net?

0 Answers  


How can objects in two diff. App Doimains communicate with each other ?

1 Answers  


Difference between remoting and web service ?

1 Answers   Digital GlobalSoft,


About Iunknown interface Queue ,its methods Query Interface Addref,Release and Explain each ?

0 Answers   DELL,


When we use web service and when we use Remoting?

2 Answers  


Categories