Regions

suggest change

A region is a collapsible block of code, that can help with the readability and organisation of your code.

NOTE: StyleCop’s rule SA1124 DoNotUseRegions discourages use of regions. They are usually a sign of badly organized code, as C# includes partial classes and other features which make regions obsolete.

You can use regions in the following way:

class Program
{
    #region Application entry point
    static void Main(string[] args)
    {
        PrintHelloWorld();
        System.Console.ReadLine();
    }
    #endregion

    #region My method
    private static void PrintHelloWorld()
    {
        System.Console.WriteLine("Hello, World!");
    }
    #endregion
}

When the above code is view in an IDE, you will be able to collapse and expand the code using the + and - symbols.

Expanded

Collapsed

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Comments and regions:
* Regions

Table Of Contents
17 Regex
19 Arrays
21 Enum
22 Tuples
24 GUID
27 Looping
36 Casting
46 Methods
55 Comments and regions
88 Events
92 Structs
104 Indexer
106 Stream
107 Timers
109 Threading
127 Caching
135 Pointers
147 C# Script