Saturday, October 24, 2015

Keywords - checked & unchecked

First understand scenarios where we can use checked & unchecked keywords

C# compiler does not throws any error at compile or run time for arithmetic overflow.
j has assigned wrong value.
checked:  Used to check arithmetic overflow, it throws arithmetic overflow exception in case of overflow.



C# compiler checks for arithmetic overflow if constant(s) involved in operation and gives compile time error.
unchecked: unchecked is used to suppress checking for arithmetic overflow by compiler

No comments:

Post a Comment

CI/CD - Safe DB Changes/Migrations

Safe DB Migrations means updating your database schema without breaking the running application and without downtime . In real systems (A...