On C # 's small skill region directive

Source: Internet
Author: User
Region directive

Sometimes, to complete a requirement, you might write dozens of lines, hundreds of lines, or even thousands of lines of code.

When the number of code is very large, although you can use very detailed comments to help read, but it is not easy to understand what the code is doing things.

As a result, C # adds a syntax format--region, which is written in the following way:

#region 描述内容
// 代码
#endregion

Region and Endregion must be written in pairs, that is, you cannot write only one region or only one endregion, and they all start with a # number.

What good does it do? Once you've written this, you can fold the code between them, like this:

In this way, for a large segment of the code, you can use this method of folding up, making the entire code easier to read.

On C # 's small skill region directive

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.