Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Where to use #region directive in C#?
It lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor. It should be terminated with #endregion.
Let us see how to define a region using #region.
#region NewClass definition
public class NewClass {
static void Main() { }
}
#endregion
The following is an example showing the usage of #region directive.
Example
using System;
#region
class MyClass {
}
#endregion
class Demo {
#region VARIABLE
int a;
#endregion
static void Main() {
#region BODY
Console.WriteLine("Example showing the usage of region directive!");
#endregion
}
}
Output
Example showing the usage of region directive!
Advertisements
