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 CS0151

A value of an integral type expected

A variable was used in a situation where an integral data type was required. This can happen when there is no conversion or if the available implicit conversions result in an ambiguous situation.

The following sample generates CS0151:

public class iii {
   public static implicit operator int (iii aa) {
      return 0;
   }
   public static implicit operator long (iii aa) {
      return 0;
   }
   public static void Main() {
      iii a = new iii();
      switch (a) {   // CS0151, compiler cannot choose between int and long
      // casting is one way to resolve this error
      // switch ((int)a) {
      case 1:
         break;
      }
   }
}