#region descriptions compiled into .exe in .net?

2019-06-19 12:40发布

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.)

4条回答
够拽才男人
2楼-- · 2019-06-19 13:32

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

查看更多
我只想做你的唯一
3楼-- · 2019-06-19 13:38

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

查看更多
贪生不怕死
4楼-- · 2019-06-19 13:43

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? :)

查看更多
唯我独甜
5楼-- · 2019-06-19 13:44

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.

查看更多
登录 后发表回答