Tag: 评论

如何在将XML文件读入XmlDocument时忽略注释?

我试图用C#读取XML文档,我这样做: XmlDocument myData = new XmlDocument(); myData.Load(“datafile.xml”); 无论如何,我有时会在阅读XmlNode.ChildNodes时收到评论。 为了让谁遇到同样的要求,最后我就是这样做的: /** Validate a file, return a XmlDocument, exclude comments */ private XmlDocument LoadAndValidate( String fileName ) { // Create XML reader settings XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreComments = true; // Exclude comments settings.ProhibitDtd = false; settings.ValidationType = ValidationType.DTD; // Validation // Create reader based on […]

从C#源文件中提取doc注释

有没有人知道任何允许你直接从.cs文件中提取注释到一些简单文本甚至剪贴板的工具? 如果这样的工具也可以在方法级别工作,那就更好了。 我不是在寻找像Sandcastle那样在构建时工作的东西,我正在寻找适用于单个源代码文件的东西。 基本上我需要将一大块方法签名和相关的文档注释复制到文本文件中,但我很无聊删除“///”并重新格式化行。 我希望能够右键单击一个方法并按照“将文档复制到剪贴板”的方式设置上下文菜单项。 有这样的工具吗?

是否可以在运行时获取类摘要?

是否可以在C#中在运行时获取类摘要? 我想通过reflection获取课程摘要,然后将其写入控制台。 通过类摘要我的意思是在类定义之前的摘要注释,如下所示: /// /// some description /// class SomeClass { } 我不知道在编译代码后这些注释是否可用,但如果它们可能有一种方法可以在代码中获取它们。 在此先感谢您的帮助。

C#中的XML多行注释 – 我做错了什么?

根据这篇文章 ,可以获得多行XML注释 – 而不是使用/// ,使用/** */ 。 这是我对多行注释的解释,以及我想要发生的事情: /** * * this comment is on line 1 in the tooltip * this comment is on line 2 in the tooltip * */ 但是,当我使用这个表单时,当我将鼠标hover在我的代码中时弹出的工具提示是单行的,即它看起来就像我写了这样的评论: /// /// this comment is on line 1 in the tooltip /// this comment is on line 2 in the tooltip /// […]

C#隐藏和取消隐藏评论

我试图找到解决方案如何在VS2010中隐藏和取消隐藏评论。 我发现的是: # region comments for code #endregion 和: Hide comments in Visual Studio 但是这个在VS2010中不起作用或者我不知道如何… 所以也许任何人都可以帮助并提供一些解决方案来隐藏以下评论: string x = “….” //comment