Is there a standard (like phpdoc or python’s docstring) for commenting C# code?

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, which give a single shortcut key to automatically generate comments for a class or method.
Sandcastle, which generates MSDN style documentation from XML comments.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)