Directives
Meaning in Life
#region, #endregion
Used to mark sections of collapsible source code
#define, #undef
Used to define and undefine conditional compilation symbols
#if, #elif, #else, #endif
Used to conditionally skip sections of source code (based on specified
compilation symbols)
Specifying Code Regions
Perhaps some of the most useful of all preprocessor directives are #region and #endregion. Using
these tags, you are able to specify a block of code that may be hidden from view and identified by a
friendly textual marker. Use of regions can help keep lengthy *.cs files more manageable. For exam-
ple, you could create one region for a type’s constructors, another for type properties, and so forth:
class Car
{
private string petName;
private int currSp;
Do'stlaringiz bilan baham: |