title: .NET Remoting with Reflection
body: <p>I need to dynamically load an interface assembly that I use on client-side remoting. Something like this.</p>
  
  <pre><code>static void Main(string[] args)
  {
    TcpClientChannel clientChannel = new TcpClientChannel();
    ChannelServices.RegisterChannel(clientChannel, false);
  
    Assembly interfaceAssembly = Assembly.LoadFile("RemotingInterface.dll");
    Type iTheInterface = 
      interfaceAssembly.GetType("RemotingInterface.ITheService");
  
    RemotingConfiguration.RegisterWellKnownClientType(iTheInterface,
                                          "tcp://localhost:9090/Remotable.rem");
    object wellKnownObject = Activator.GetObject(iTheInterface, 
                                          "tcp://localhost:9090/Remotable.rem");
  }
  </code></pre>
  
  <p>Only I can't seem to grasp how to call any methods as I can't cast the Activator.GetObject. How can I create a proxy of ITheService without knowing the interface at compile-time?</p>