从 C# 中的对象成员获取友好描述
如何以编程方式从对象成员获取描述?
如果我使用 Visual Studio 中内置的对象浏览器,我可以浏览特定对象并获取每个对象的人类可编辑描述。例如,浏览{} System.Text.RegularExpressions并选择“Match(string)”成员将在对象浏览器的右下窗格中显示以下描述:
public System.Text .RegularExpressions.Match 匹配(字符串输入) System.Text.RegularExpressions.Regex 的成员
摘要:
在指定的输入字符串中搜索 System.Text.RegularExpressions.Regex 构造函数中指定的正则表达式的第一次出现。
参数:
输入:用于搜索匹配项的字符串。
退货:
包含有关匹配信息的对象。 例外情况: System.ArgumentNullException: input is null.
我如何让 C# 中的控制台应用程序输出相同的信息?我尝试过反射和枚举,但没有成功解决。我对此事进行了搜索,但由于我不知道应该搜索什么,所以没有找到任何东西可以指引我正确的方向。
谢谢 威龙
How do i get the description from a object member programmaticly?
If i use the built in Object Browser in Visual Studio i can browse a specific object and get a human redable description for every object. For example browsing {} System.Text.RegularExpressions and choosing the "Match(string)" member would give me the following description in the lower right pane of the Object Browser:
public System.Text.RegularExpressions.Match Match(string input)
Member of System.Text.RegularExpressions.Regex
Summary:
Searches the specified input string for the first occurrence of the regular expression specified in the System.Text.RegularExpressions.Regex constructor.
Parameters:
input: The string to search for a match.
Returns:
An object that contains information about the match.
Exceptions:
System.ArgumentNullException: input is null.
How can i get a Console application in C# to output the same information? I have tried with both reflections and enums but have not manage to work it out. I have search in the matter but since I don't know what i should be searching for i have found nothing to point me in the right direction.
Thanks
Wylon
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要为此生成的 XML 文件,并在其中查找您的信息。注释数据不会嵌入到已编译的程序集中。
You would need the generated XML file for that, and look up your information in that. The comment data does not get embedded into compiled assemblies.