The Operater Checked and Unchecked

   public void main(string[] args)
{        
    Byte b = 255;
            checked
            {
               b++;
             }
         Console.WriteLine(b.ToString());
}
      Results:
         Unhandled Exception :System.OverflowException:Arithmetic opertation resulted in an overflow at ...;
   if you want to forbid it to run
just change checked to Unchecked

Of course The Results Will Lost Date,The Result is Zero;
posted @ 2007-04-02 15:44  David.You  阅读(214)  评论(0编辑  收藏  举报