Description
XML Doc comments are verbose, ugly, and annoying to write and read, even with the IDE support Visual Studio provides. There's no reason human beings should have to be manually typing or reading XML. With the language design committee starting work on C# 7.0, I'd propose taking a fresh look at how documentation could be written in C#.
JSDoc syntax is much more lightweight and easy to write and maintain. The chief problem with adding it is that the /**
delimiter is already valid for XML docs (though I've never seen this used anywhere). Therefore, I'd propose a slight modification of the JSDoc syntax:
/*/ This method does foo.
* @param bar An important {@link Bar} parameter.
* @returns An important integer. */
public int Foo(Bar bar) { }
class Bar { }
Note the extra slash as part of the delimiter for this new type of comment. (Open to other suggestions here).
Compare this to the verbosity of the current XML Docs:
/// <summary>This method does foo.</summary>
/// <param name="bar">An important <see cref="T:Bar"/> parameter.</param>
/// <returns>An important integer.</returns>
public int Foo(Bar bar) { }
class Bar { }
The JSDoc is much easier to both read and write. In the simple example above, it is only 115 characters, compared to 165 characters for the XML Doc, a savings of 30%. Savings like this could make an enormous difference when you consider how much documentation has to exist in a large codebase.
JSDoc reference:
http://usejsdoc.org/
Original issues on CodePlex:
https://roslyn.codeplex.com/workitem/215
https://roslyn.codeplex.com/workitem/188
Uservoice:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3987312-c-doc