title: Is MarshalByRefObject special?
body: <p>.NET has a thing called remoting where you can pass objects around between separate appdomains or even physical machines. I don't fully understand how the magic is done, hence this question.</p>
  
  <p>In remoting there are two base ways of passing objects around - either they can be serialized (converted to a bunch of bytes and the rebuilt at the other end) or they can inherit from <a href="http://msdn.microsoft.com/en-us/library/system.marshalbyrefobject.aspx" rel="noreferrer">MarshalByRefObject</a>, in which case .NET makes some transparent proxies and all method calls are forwarded back to the original instance.</p>
  
  <p>This is pretty cool and works like magic. And I don't like magic in programming. Looking at the <code>MarshalByRefObject</code> with the Reflector I don't see anything that would set it apart from any other typical object. Not even a weird internal attribute or anything. So how is the whole transparent proxy thing organized? Can I make such a mechanism myself? Can I make an alternate <code>MyMarshalByRefObject</code> which would not inherit from <code>MarshalByRefObject</code> but would still act the same? Or is <code>MarshalByRefObject</code> receiving some special treatment by the .NET engine itself and the whole remoting feat is non-duplicatable by mere mortals?</p>