有没有标准(如phpdoc或python的docstring)评论C#代码? [英] Is there a standard (like phpdoc or python's docstring) for commenting C# code?

查看:121
本文介绍了有没有标准(如phpdoc或python的docstring)评论C#代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个标准约定(如phpdoc或python的docstring)用于注释C#代码,以便类文档可以从源代码自动生成

Is there a standard convention (like phpdoc or python's docstring) for commenting C# code so that class documentation can be automatically generated from the source code?

推荐答案

您可以使用XML样式注释,并使用工具将这些注释导出到API文档中。

You can use XML style comments, and use tools to pull those comments out into API documentation.

以下是注释样式的示例:

Here is an example of the comment style:

/// <summary>
/// Authenticates a user based on a username and password.
/// </summary>
/// <param name="username">The username.</param>
/// <param name="password">The password.</param>
/// <returns>
/// True, if authentication is successful, otherwise False.
/// </returns>
/// <remarks>
/// For use with local systems
/// </remarks>
public override bool Authenticate(string username, string password)

GhostDoc 给出单个快捷键来自动为类或方法生成注释。
Sandcastle ,它从XML注释生成MSDN样式文档。

GhostDoc, which give a single shortcut key to automatically generate comments for a class or method. Sandcastle, which generates MSDN style documentation from XML comments.

这篇关于有没有标准(如phpdoc或python的docstring)评论C#代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆