C # basic -- check, lock, and using statement Induction

Source: Internet
Author: User

I. C # statement Overview (this part comes from the Network)

Statement (statement ):Program activities are expressed by statements. C # supports multiple different statements. Many statements are defined in the form of embedded statements.

Block ):You can write multiple statements in the context where only one statement can be used. A block consists of a list of statements enclosed in braces.

Statement (declaration statement ):Declare local variables and constants.

Expression statement ):Expressions include method calls, object allocation using the new operator, and assignment using the "=" and compound assignment operators, and the increment and decrement operations using the "++" and "--" operators.

Selection statement ):Used to select one of several possible statements based on the value of an expression.

If else statement

Switch statement

Iteration statement ):Used to execute embedded statements repeatedly

While statement

Do While statement

For statement

Foreach statement.

Jump statement (jump statement ):It is used for transfer program control.

Break statement

Continue statement

Goto statement

Throw statement

Return Statement

Exception Handling statement(Try-catch-finally ):Used to capture exceptions that occur during block execution.

Try-catch statement

Try-finally statement

Try-catch-finally statement

The try-[catch]-finally statement is used to specify a termination code block. whether an exception occurs or not, it is always executed.

Ii. checked and unchecked statements: used to control integer arithmetic operations and overflow checks for conversions.

Checked checks possible violations in the domain to which it applies and throws an exception. unchecked blocks all checks.

For example:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.