Pre-Processor VisualDirectives

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
CSharp-Online.NET:Tutorials
C# Tutorials
C# Preprocessor Directives
edit

Contents


Usage

The visual Pre-Processor Directive Commands #region and #endregion are probably the most used commands of the lot. The reason for this is that they allow for customized code folding.

Example

Take for example the following class, notice on the left hand side the '+' symbols showing the automatic code folding areas. Note that this is optional and may be disabled in MS Visual Studio.

Image:PersonEgClass1.gif

Although this isn't a huge amount of code it does lend itself to regions under particular headings.

Image:PersonEgClass2.gif

Once the regions have been created they can be collapsed just like any of the automatic code folding areas

Image:PersonEgClass3.gif


MSDN References


Personal tools