title: Why can't I define both implicit and explicit operators?
body: <p>Why I cannot define both implicit and explicit operators like so?</p>
  
  <pre><code>    public class C
      {
          public static implicit operator string(C c)
          {
              return "implicit";
          }
  
          public static explicit operator string(C c)
          {
              return "explicit";
          }
      }
  </code></pre>
  
  <p>You can do this hack though :)</p>
  
  <pre><code>    class Program
      {
          public class A
          {
  
          }
  
          public class B
          {
              public static implicit operator A(B b)
              {
                  Console.WriteLine("implicit");
                  return new A();
              }
          }
  
          public class C : B
          {
              public static explicit operator A(C c)
              {
                  Console.WriteLine("explicit");
                  return new A();
              }
          }
  
          static void Main(string[] args)
          {
              C c = new C();
  
              A a = c;
              A b = (A) c;
          }
      }
  </code></pre>
  
  <p>This prints:</p>
  
  <pre><code>implicit
  explicit
  </code></pre>