In a C# class with a single constructor, I can add class summary XML documentation and constructor XML documentation:
///
///This class will s
I looked at the source of the open-source F# compiler and I think Dr_Asik is right - there is no way of documenting the implicit constructor with an XML comment. The node that represents the implicit constructor in the AST (See ImplicitCtor
in ast.fs
here) does not include a field for stroing the XML documentation (represented as PreXmlDoc
type).
You can still document all public API - you'd have to use the method that Dr_Asik mentioned and mark the implicit constructor as private
. I agree this is a bit ugly, but I think it is more convenient than not using implicit constructors:
type MyType private(a:int, u:unit) =
/// Creates MyType
/// Parameter A
new(a:int) = MyType(a, ())
I added a dummy parameter u
to the implicit constructor, so that it can be called from the public constructor. Anyway, I think this should be considered as a language bug and so I'd suggest reporting this to fsbugs
at microsoft
dot com
.
As an aside, I think the XML documentation is mainly useful as a source of data for IntelliSense (which still needs documentation for the constructor, though) and I created some alternative F# tools that let you create tutorials and documentation by writing an F# script file with special comments using Markdown (there is a blog post about it) - so you may consider that as a useful addition to the standard XML tooling.