Documenting F# Code

后端 未结 4 1626
时光取名叫无心
时光取名叫无心 2020-12-30 00:35

In a C# class with a single constructor, I can add class summary XML documentation and constructor XML documentation:

///
///This class will s         


        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-30 01:06

    In exactly the same way as you do in C#: http://msdn.microsoft.com/en-us/library/dd233217.aspx

    If you don't put any tags, F# assumes it is "summary":

    /// This is the documentation
    type MyType() = ....
    

    ... is equivalent to

    /// This is the documentation
    type MyType() = ...
    

    If you want to document a constructor, you'll have to declare it explicitely. AFAIK there is no way to document the primary constructor.

    /// [Type summary goes here]
    type MyType(a : int) =
        let m_a = a
        /// [Parameterless constructor documentation here]
        new() = MyType(0)
    

提交回复
热议问题