简体   繁体   English

可以通过Reflection得到装配的注释吗?

[英]Is possible to get the comments of an assembly through Reflection?

我想知道是否有办法通过Reflection访问类的注释,或者它们是否完全从二进制文件中删除。

没有。评论被编译器剥离 - 它们不存在于二进制文件中,所以没有办法让它们恢复。

Comments are ignored when code is compiled. 编译代码时忽略注释。

This means you can't get them "back" as they were never there in the first place. 这意味着你不能让他们“回来”,因为他们从来没有在那里。

Comments are ignored when code get complied by compiler. 当代码被编译器编译时,将忽略注释。

But you can pass information in the Attributes by creating your own user defined attribute class. 但您可以通过创建自己的用户定义属性类来传递属性中的信息。

Comments are not available from the binaries, but they are via XML. 二进制文件不提供注释,但它们是通过XML提供的。 See this SO answer . 看到这个答案

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

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