XML documentation for interface methods and record properties

点点圈 提交于 2019-12-01 21:50:21

Note that you can omit the summary tag when you don't have other tags like params and returns. So this:

///Well, it's a summary
type Summary

is equivalent to this:

///<summary>Well, it's a summary</summary>
type Summary

1) Descriptions for record fields work in VS2012:

2) You can use parameter names in abstract methods like this:

type IPathFilter =
    abstract member Run : paths:seq<string> -> seq<Summary>

As noted by Patryk Ćwiek in the comment above, Microsoft has confirmed this as a bug. Just to clarify what actually happens: When the F# compiler generates the documentation file, it actually documents the internal field instead of the public property of the record member.

For instance, the documentation for your Summary type above is generated as:

...
<member name="F:Test.Summary.IsSuccessful">
   <summary>Gets whether the action was successful or not</summary>
</member>
<member name="F:Test.Summary.Name">
   <summary>Gets a short name</summary>
</member>
<member name="T:Test.Summary">
   <summary>Well, it's a summary</summary>
</member>
...

Note the F: prefix in the documentation of the member names. Change that to P: and Visual Studio immediately displays the comments in your C# project. So until this bug is fixed and the documentation is actually generated for the properties, the only option you have is to manually process the documentation file in a post-build step.

By the way, this also explains why it works in F#: Apparently, the F# bindings for Visual Studio use the field to look up the documentation. This even works across several F# libraries, despite the fact that the field has internal visibility.

Update: This bug should be fixed with F# 3.1.2. See also the release notes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!