在具有单个构造函数的C#类中,我可以添加类摘要XML文档和构造函数XML文档:
///<summary>
///This class will solve all your problems
///</summary>
public class Awesome
{
/// <summary>
/// Initializes a new instance of the <see cref="Awesome"/> class.
/// </summary>
/// <param name="sauce">The secret sauce.</param>
public Awesome(string sauce)
{
//...implementation elided for security purposes
}
}
Run Code Online (Sandbox Code Playgroud)
如何使用等效的F#类进行相同的操作,以使生成的文档相同?
type Awesome(sauce: string) =
//...implementation elided for security purposes
Run Code Online (Sandbox Code Playgroud)
澄清:我知道标准的XML文档标签可以在F#中使用.我的问题是如何将它们添加到上面的代码片段,以便记录类型和构造函数.
C# 9 记录有一个简短的形式,如下所示:
public record Car(int CarId, int Cylinders, string Make, string Model);
Run Code Online (Sandbox Code Playgroud)
如何将文档注释添加到记录的属性中?请注意,这是不同的这一哪个询问长形式等问题。