About the switch in. net

Source: Internet
Author: User

As a process control statement, switch has an irreplaceable position in various languages. Of course,. Net cannot be customized.

The differences between the switch and other languages in. NET are described in C:

1. No sequence. In C #, the discharge sequence of the Case clause is irrelevant. You can set the default clause to the beginning.

2. the compiler will mark the case clause without a break statement as an error. Special case: if the case clause is null, you can leave it empty.

3. If the first case clause in the block is activated, the subsequent case clause will not be activated, unless you use the GOTO statement to specifically mark the case clause to be activated (determined by 2 ). Special case: if a case clause is null, you can jump from this case to the next case, so that two or more case clauses can be processed in the same way (goto statements are not required)

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.