title: how to use MarshalByRefObject to call class in different app domain
body: <p>I am trying to implement a version of example 1 from here <a href="http://msdn.microsoft.com/en-us/library/System.MarshalByRefObject(v=vs.110).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/System.MarshalByRefObject(v=vs.110).aspx</a> into my code. </p>
  
  <p>My aim is to have a class with some methods then load that class into a different appdomain and call its method. </p>
  
  <p>so far I have: </p>
  
  <pre><code> public class diffDomain : MarshalByRefObject
   {
        public int getNumber()
        {
             return 5;
        }
   }
   internal static class JITCompiler
   {
        internal static wantNumber()
        {
             AppDomain domain = AppDomain.CreateDomain("MyDomain");
             var newSearch = (diffDomain)domain.CreateInstanceAndUnwrap(
                              Assembly.GetExecutingAssembly().FullName,
                              "diffDomain");
        }
   }
  </code></pre>
  
  <p>I get an error on the Var newSearch line:</p>
  
  <pre><code>Could not load type 'diffDomain' from assembly 'SVM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
  </code></pre>