NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error CS0035

Operator 'operator' is ambiguous on an operand of type 'type'

The compiler has more than one available conversion and does not know which to choose before applying the operator.

The following sample generates CS0035:

class MyClass {
   private int i;

   public MyClass(int i) {
      this.i = i;
   }

   public static implicit operator double(MyClass x) {
      return (double) x.i;
   }

   public static implicit operator decimal(MyClass x) {
      return (decimal) x.i; 
   }
}

class MyClass2 {
   static void Main() {
      MyClass x = new MyClass(7);
      object o = - x;   // CS0035
      // try a cast:
      // object o = - (double)x;
   }
}