unchecked marker : unchecked « Data Type « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Text;


  class Program
  {
    static void Main(string[] args)
    {
      // Declare two shorts to add.
      short numb1 = 30000, numb2 = 30000;
      // This will not throw an exception.
      unchecked
      {
        short answer = (short)Add(numb1, numb2);
        Console.WriteLine("{0} + {1} = {2}",
            numb1, numb2, answer);
      }

    }

    static int Add(int x, int y){ return x + y; }
  }








2.49.unchecked
2.49.1.Mark expressions as unchecked
2.49.2.An Unchecked Block Example
2.49.3.unchecked marker
2.49.4.Overflow the max value of a System.Byte