C# #region directive
In this chapter you will learn:
Using #region directive
The #region
and #endregion
directives define a
region that will be expanded or collapsed when using
outlining in the Visual Studio IDE.
Syntax
The general form is shown here:
#region region-name
// code sequence
#endregion
Example
The following code shows how to use #region
and #endregion
.
using System;/* w ww. ja v a2s . co m*/
class MainClass
{
[STAThread]
static void Main(string[] args)
{
#region Stuff
#endregion
}
}
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- #warning directive produces a warning
- Syntax for #warning preprocessor
- Example for #warning preprocessor
- Unused Warning With Warning Suppressed