title: Compilation error with primitives types with implementations of generic methods of an interface
body: <p>I want to write an interface which allows freedom in the implementation. Basically I don't know the return types neither param types of the methods. I just want derived classes to implement this contract with same method names and param numbers.</p>
  
  <p>So I can do like this:</p>
  
  <pre><code>public interface IImageRecognitionEngine&lt;TFoo0, TFoo1, TFoo2, TFoo3&gt;
  {
      TFoo0 Learn(TFoo1 param);
      TFoo2 Recognize(TFoo3 param);
  }
  
  public class FooImageRecognitionEngine : IImageRecognitionEngine&lt;byte[], string, List&lt;double&gt;, string&gt;
  {
      public byte[] Learn(string param)
      {
          throw new NotImplementedException();
      }
  
      public List&lt;double&gt; Recognize(string param)
      {
          throw new NotImplementedException();
      }
  }
  </code></pre>
  
  <p>But I would much more prefer generic methods instead of the whole interface. But I don't understand why I can do this:</p>
  
  <pre><code>public interface IImageRecognitionEngine2
  {
      TFoo0 Learn&lt;TFoo0, TFoo1&gt;(TFoo1 param);
      TFoo2 Recognize&lt;TFoo2, TFoo3&gt;(TFoo3 param);
  }
  
  public class FooExampleClass
  {
  
  }
  
  public class FooExampleClass2
  {
  
  }
  
  public class Foo1ImageRecognitionEngine2 : IImageRecognitionEngine2
  {
      public FooExampleClass Learn&lt;FooExampleClass, FooExampleClass2&gt;(FooExampleClass2 param)
      {
          throw new NotImplementedException();
      }
  
      public FooExampleClass Recognize&lt;FooExampleClass, FooExampleClass2&gt;(FooExampleClass2 param)
      {
          throw new NotImplementedException();
      }
  }
  </code></pre>
  
  <p>But with primitive types the compiler gives me errors:</p>
  
  <pre><code>public class Foo2ImageRecognitionEngine2 : IImageRecognitionEngine2
  {
      public byte[] Learn&lt;byte[], string&gt;(string param)
      {
          throw new NotImplementedException();
      }
  
      public List&lt;double&gt; Recognize&lt;List&lt;double&gt;, string&gt;(string param)
      {
          throw new NotImplementedException();
      }
  }
  </code></pre>
  
  <p>I don't want to be able to chose what types to use when I instantiate an object of the class implementation. For example, I don't want to  write an implementation like this:</p>
  
  <pre><code>public class Foo2ImageRecognitionEngine2 : IImageRecognitionEngine2
  {
      public TFoo0 Learn&lt;TFoo0, TFoo1&gt;(TFoo1 param)
      {
          throw new NotImplementedException();
      }
  
      public TFoo2 Recognize&lt;TFoo2, TFoo3&gt;(TFoo3 param)
      {
          throw new NotImplementedException();
      }
  }
  </code></pre>
  
  <p>And being able to do this:</p>
  
  <pre><code>var fooEngine = new Foo2ImageRecognitionEngine2();
  fooEngine.Learn&lt;string, int&gt;(52);
  </code></pre>
  
  <p>And this doesn't work also:</p>
  
  <pre><code>public interface IImageRecognitionEngine3
  {
      object Learn(object param);
      object Recognize(object param);
  }
  
  public class Foo1ImageRecognitionEngine3 : IImageRecognitionEngine3
  {
      public byte[] Learn(string param)
      {
          throw new NotImplementedException();
      }
  
      public List&lt;double&gt; Recognize(string param)
      {
          throw new NotImplementedException();
      }
  }
  </code></pre>
  
  <p>Thank you</p>