title: Why isn't there an implicit typeof?
body: <p>I think I understand why this small C# console application will not compile:</p>
  
  <pre><code>using System;
  
  namespace ConsoleApp1
  {
      class Program
      {
          static void WriteFullName(Type t)
          {
              Console.WriteLine(t.FullName);
          }
  
          static void Main(string[] args)
          {
              WriteFullName(System.Text.Encoding);
          }
      }
  }
  </code></pre>
  
  <p>The compiler raises a CS0119 error: <code>'Encoding' is a type which is not valid in the given context</code>. I know that I can produce a Type object from its name by using the <code>typeof()</code> operator:</p>
  
  <pre><code>        ...
          static void Main(string[] args)
          {
              WriteFullName(typeof(System.Text.Encoding));
          }
          ...
  </code></pre>
  
  <p>And everything works as expected.</p>
  
  <p>But to me, that use of <code>typeof()</code> has always seemed somewhat redundant. If the compiler knows that some token is a reference to a given type (as error CS0119 suggests) and it knows that the destination of some assignment (be it a function parameter, a variable or whatever) expects a reference to a given type, why can't the compiler take it as an implicit <code>typeof()</code> call?</p>
  
  <p>Or maybe the compiler is perfectly capable of taking that step, but it has been chosen not to because of the problems that might generate. Would that result in any ambiguity/legibility issues that I cannot think of right now?</p>