title: C#: Generic method doesn't call specific method overload
body: <p>I am trying to create a generic method in C#, which will call different methods based on the argument datatype in its body and process their result afterwards. I am trying to achieve this by creating a generic wrapper method and then provide several overloads of the processing method - including a generic one that'll be used if no specific overload is available.</p>
  
  <p>When I call the processing method directly, appropriate version is correctly selected. However when I call it from the wrapper method it always selects the generic one, even if there's a matching overload for the specific datatype I passed to it.</p>
  
  <p>Is there any way to adjust the code to make it behave the way I need to? Or do I have to use a different approach.</p>
  
  <p>I need the code to be compatible with Mono 2.6.</p>
  
  <pre><code>using System;
  
  class Program
  {
      static void Func&lt;T&gt;(T val)
      {
          Console.WriteLine("Generic Func");
      }
  
      static void Func(int val)
      {
          Console.WriteLine("Int Func");
      }
  
      static void Func(string val)
      {
          Console.WriteLine("String Func");
      }
  
      static void FuncWrap&lt;T&gt;(T val)
      {
          Console.Write("Wrap: ");
          Func(val);
      }
  
      static void Main(string[] args)
      {
          Func(2);
          Func("Potato");
          Func(2.0);
  
          FuncWrap(2);
          FuncWrap("Potato");
          FuncWrap(2.0);
  
          Console.Read();
      }
  }
  </code></pre>