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 CS0173

Type of conditional expression can't be determined because there is no implicit conversion between 'class1' and 'class2'

Conversions between classes are useful when you want objects of different classes to work with the same code. However, two classes that will work together cannot have mutual and redundant conversions. To resolve CS0173, make sure that there is one and only one conversion, regardless of which direction the conversion is in and regardless of which class the conversion is in.

// to resolve, remove one conversion routine
public class iii {

   // a conversion routine
   public static implicit operator a(iii aa) {
      return new a();
   }
   // a conversion routine
   public static implicit operator iii(a aa) {
      return new iii();
   }
   public static void Main() {
       a aa = new a();
       iii ii = new iii();

       a aaa = (1 == 1) ? aa : ii; // CS0173
   }
}

public class a {
   // a conversion routine
   public static implicit operator a(iii aa) {
      return new a();
   }
   // a conversion routine
   public static implicit operator iii(a aa) {
      return new iii();
   }
}