简体   繁体   English

评论编译成.net中的.exe?

[英]comments compiled into .exe in .net?

I know you can use a .net reflector to view code created with .net but if I put something in the comments for my own personal reminder is that compiled in the exe as well. 我知道你可以使用.net反射器来查看用.net创建的代码,但是如果我在评论中添加一些内容,我自己的个人提醒也是在exe中编译的。

I don't intend to release the source code for my application and i know the 100% safe bet is to just remove everything I don't want out but I was just wondering if someone could reverse engineer my comments. 我不打算发布我的应用程序的源代码,我知道100%安全的赌注是删除我不想要的所有内容,但我只是想知道是否有人可以对我的评论进行反向工程。

Comments are ignored by the compiler. 编译器会忽略注释。 They will not be put into the output executable. 它们不会被放入输出可执行文件中。

不,注释不在编译的可执行文件中。

No, comments are not included in your code; 不,评论不包含在您的代码中; however, classes, methods and members are. 但是,类,方​​法和成员是。 So, if you are using self-documenting code, some of the logic will be discernible. 因此,如果您使用自我记录代码,则可以辨别出一些逻辑。 I recommend using obfuscation if you are concerned about anyone reflecting information from your delivered code. 如果您担心任何人反映您交付的代码中的信息,我建议您使用混淆。

As the other say: Comments are not compiled in. But you can enable the xml documentation creation in the C# project settings. 正如另一个所说:注释未编译。但您可以在C#项目设置中启用xml文档创建。 If you then use the MS documentation syntax (/// <summary>...</summary> and so on) an extra .xml file will be generated. 如果您随后使用MS文档语法(/// <summary> ... </ summary>等),将生成一个额外的.xml文件。

If Reflector loads an assembly it also looks for the .xml documentation file and decorates the declarations with the documentation found in the XML file! 如果Reflector加载程序集,它还会查找.xml文档文件,并使用XML文件中的文档修饰声明!

If you'd like to check what's in there yourself, get hold of the 'strings' utility (Cygwin version is fine) and run it over your code. 如果你想自己检查那里有什么,请抓住'strings'实用程序(Cygwin版本没问题)并在你的代码上运行它。 It'll print out all the legible strings in your binary files. 它将打印出二进制文件中所有易读的字符串。 And no, as others have said, no comments make it through. 不,正如其他人所说,没有任何评论可以通过。

不用担心,编译器会忽略注释。

Just note, the PDB files may contain this information. 请注意,PDB文件可能包含此信息。

Check out: How much information do pdb files contain? 检查: pdb文件包含多少信息? (C# / .NET) (C#/ .NET)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM