title: Dynamic Method Invocation without Reflection
body: <p>Does anyone knows how can I invoke method dynamically without reflection?</p>
  
  <p>I`ll try to specify my question below</p>
  
  <p>Suppose we have an interface <code>IMyInterface</code> and <code>MyImplementation</code> is an implementation of <code>IMyInterface</code>. Besides of that I have a generic proxy class <code>MyProxy&lt;T&gt; where T : IMyInterface</code>. In this proxy I wanna wrap all calls to all methods that have been defined in <code>MyImplementation</code> and in all inheritors of this class. The purpose I wanna achieve is the dynamic method invocation. In case of reflection everything will be transparent, but as I understand it might be quite slow. Does anyone know about solution that could be much faster?</p>
  
  <p>Thanks a lot!</p>
  
  <p>-- update </p>
  
  <p>hmm, looks like my previous descriptions was not good, so I`ll try to describe my question again. With examples :)</p>
  
  <p>So, lets imagine that we have the following code:</p>
  
  <pre><code>public interface IMyInterface
  {
       void Method();
  }
  
  public class MyImplementation : IMyInterface
  {
       public void Method()
       {
            Console.WriteLine("Yeaah!");
       }
  }
  </code></pre>
  
  <p>The important point that I forgot to mention is that we have a class named for example Holder. This class should be used by the following way</p>
  
  <pre><code>var holder = // the way of instantiation doesn`t really matters
  holder.Register(myImplementationInstance);
  
  var myInterfaceInstance = holder.Resolve&lt;IMyInterface&gt;();
  myInterfaceInstance.Method();
  </code></pre>
  
  <p>Holder instance will return some wrapper that will implement <code>IMyInterface</code> and will wrap the real instance of myImplementation that has been registered.</p>
  
  <p>As I said above we have a wrapper <code>MyImplementationWrapper</code> that implements <code>IMyInterface</code> and has the method named Method with the following body</p>
  
  <pre><code>public void Method()
  {
      _wrappedInstance.Method();
  }
  </code></pre>
  
  <p>So, there are two questions
  a) How can I automatically create the wrapper for <code>myImplementationInstance</code> (I don<code>t want to know anything about object that will be registred in</code>Holder<code>)
  b) How can I dynamically invoke the methods of</code>myImplementationInstance` by its wrapper</p>