unchecked block
unchecked (expression)
public void Page_Load(object sender, EventArgs e) { Response.Write(UncheckedTest()); } public int UncheckedTest() { // Unchecked used as a statement // Without this statement you will get the following error: // CS0220: The operation overflows at compile time in checked mode unchecked { // max int value multiplied by 2 // which usually overflows int total = 2147483647 * 2; return total; } }
Build Your Own ASP.NET Website Using C# & VB.NET