title: Why does an explicit cast to ‘decimal’ call an explicit operator to ‘long’?
body: <p>Consider the following code:</p>
  
  <pre><code>class Program
  {
      public static explicit operator long(Program x) { return 47; }
  
      static int Main(string[] args)
      {
          var x = new Program();
          Console.WriteLine((decimal) x);
      }
  }
  </code></pre>
  
  <p>To my surprise, this outputs <code>47</code>; in other words, the <code>explicit operator long</code> is called even though the cast is to <code>decimal</code>.</p>
  
  <p>Is there something in the C# spec that explicitly says that this should happen (if so, where exactly) or is this the result of some other rule(s) I’m missing?</p>