In C #, # The role of Region

Source: Internet
Author: User
Tags alphanumeric characters

The # region and # endregion commands are used to mark a piece of code as a block with a given name, so that the code can be better laid out on the screen. For example:

    /// <Summary>
   /// Parses one line in a gedcom file.
   /// </Summary>
   Class gedcomline
   {
       # Region Fields

       // Parts of the gedcom line.
       Private int level;
       Private string tag;
       Private string data;

       // Expression pattern used to parse the gedcom line.
       Private readonly RegEx regsplit = new RegEx (
           @"(? <Level> \ D +) \ s + (? <Tag> [\ s] +) (\ s + (? <DATA>. + ))? ");

       // Expression pattern used to clean up the gedcom line.
       // Only allow viewable characters.
       Private readonly RegEx regclean = new RegEx (@ "[^ \ x20-\ x7e]");

       // Expression pattern used to clean up the gedcom tag.
       // Tag can contain alphanumeric characters, _,., or -.
       Private readonly RegEx regtag = new RegEx (@ "[^ \ W.-]");

       # Endregion

       # Region Properties

       /// <Summary>
       /// Level of the tag.
       /// </Summary>
       Public int level
       {
           Get {return this. level ;}
           Set {This. Level = value ;}
       }

       /// <Summary>
       /// Line tag.
       /// </Summary>
       Public String tag
       {
           Get {return this. Tag ;}
           Set {This. Tag = value ;}
       }

       /// <Summary>
       /// Data of the tag.
       /// </Summary>
       Public String data
       {
           Get {return this. Data ;}
           Set {This. Data = value ;}
       }

       # Endregion

       .

       .

       .

    }

In the vs editing view, you can zoom in:

    /// <Summary>
   /// Parses one line in a gedcom file.
   /// </Summary>
   Class gedcomline
   {

        Fields

       Properties

       .

       .

       .

   }

Http://blog.sina.com.cn/s/blog_5d0279370100b6ep.html

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.