是否有注释的C#代码的标准(如PHPDoc的或Python的文档字符串)? [英] Is there a standard (like phpdoc or python's docstring) for commenting C# code?

查看:172
本文介绍了是否有注释的C#代码的标准(如PHPDoc的或Python的文档字符串)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有注释的C#代码,使类文档可以从源代码自动生成一个标准的约定(如PHPDoc的或Python的文档字符串)?

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)



一些项目,以促进这个是

Some items to facilitate this are:

GhostDoc ,该给一个快捷键自动生成一个类或方法的注释。
沙堡,生成的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.

这篇关于是否有注释的C#代码的标准(如PHPDoc的或Python的文档字符串)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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