#region descriptions compiled into .exe in .net?

2019-06-19 13:12发布

问题:

Are #region/#endregion directive "descriptions" compiled into the .EXE in .NET? I understand that comments are NOT, but I often chunk groups of code within a region and give it a useful description.

I want to make sure these descriptions are not visible in my compiled code. (I am not looking for obfuscation information. Thanks, though.)

回答1:

Region is the one of C# Preprocessor Directives.

Although the compiler does not have a separate preprocessor, the directives described in this link

http://msdn.microsoft.com/en-us/library/ed8yd1ha(v=vs.110).aspx

are processed as if there were one.

But I wonder that, what is the aim of this question? :)



回答2:

No, they aren't. They are Preprocessor expressions, which won't end up in code.



回答3:

No, they're not. Region descriptions are basically comments, and aren't included in either the assembly itself or the PDB.



回答4:

No, they aren't. They are like comments. Look at Pre-processing directives

The pre-processing directives provide the ability to conditionally skip sections of source files, to report error and warning conditions, and to delineate distinct regions of source code. The term "pre-processing directives" is used only for consistency with the C and C++ programming languages. In C#, there is no separate pre-processing step; pre-processing directives are processed as part of the lexical analysis phase. Pre-processing directives are not tokens and are not part of the syntactic grammar of C#. However, pre-processing directives can be used to include or exclude sequences of tokens and can in that way affect the meaning of a C# program.