1

这个问题源于这个问题 Code documentation how much is too much?

答案之一是将您的 xml 文档保存在单独的文件中。我真的很喜欢这个答案,因为当我查看代码时,文档的冗长令人讨厌,另一方面,在通过智​​能感知搜索正确的方法或发布文档时,冗长很有用。

答案是使用包含标签

/// <include file="Documentation/XML/YourClass.xml" path="//documentation/members[@name='YourClass']/*"/>

这里还有一篇关于包含标签的 MSDN 文章

我想出了如何保留摘要信息,但我不知道也找不到如何将方法文档放在那里。(这比课程摘要本身更重要。

4

1 回答 1

1

答案很简单。读取生成的 xml 文件。他们给出了分离的 xml 文件应该是什么样子的想法。

读取生成的 xml 文件以及如何描述方法(使用参数等):

<member name="M:BitFactory.Logging.Logger.DoLog(BitFactory.Logging.LogEntry)">
    <summary>
    Really log aLogEntry. (We are past filtering at this point.)
    Subclasses might want to do something more interesting and override this method.
    </summary>
    <param name="aLogEntry">The LogEntry to log</param>
    <returns>true upon success, false upon failure.</returns>
</member>

T、M、F 前缀类型、方法、字段。

于 2009-03-09T17:48:58.223 回答