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 Warning (level 3) CS0220

The operation overflows at compile time in checked mode

An operation was detected by checked, which is the default, that resulted in a data loss. Either correct the inputs to the assignment or use unchecked to resolve this error.

The following sample generates CS0220:

using System;
class TestClass {

   const int x = 1000000;
   const int y = 1000000;

   public int MethodCh() {
      int z = (x * y);   // CS0220
      return z;
   }

   public int MethodUnCh() {
      unchecked {
         int z = (x * y);
         return z;
      }
   }

   public static void Main() {
      TestClass myObject = new TestClass();
      Console.WriteLine("Checked  : {0}", myObject.MethodCh());
      Console.WriteLine("Unchecked: {0}", myObject.MethodUnCh());
   }
}