views:

550

answers:

10

I'm moving to C# from Java and wanted to know what the most widely used documentation tool is? What is the equivalent of Javadoc in C#-land?

+1  A: 

SandCastle

Darin Dimitrov
+9  A: 

The default documentation format is the /// xml documentation you see in most sample code. It is parsed by the C# compiler, which creates a .xml file containing the exact location and the custom Xml. Visual Studio can use this xml for intellisense and there are a few tools that can turn this xml in pretty html.

  • NDoc was the most common tool in the past, but lacks .Net 2.0 support.
  • SandCastle is a more modern variant and is now used by Microsoft to generate the MSDN help.

Another useful helper is Ghostdoc that can generate a help template on clicking a shortcut like Ctrl+Shift+D in Visual Studio.

Bert Huijben
What happened to NDoc?
Nosrama
http://en.wikipedia.org/wiki/NDoc says that the primary developer stopped 'due to lack of funding and threats against him, and that he is willing to hand over administration of the project'
Bert Huijben
+1  A: 

what you probably need is Sandcastle.

Mladen Prajdic
Dup of http://stackoverflow.com/questions/1205621/whats-the-most-widely-used-documentation-tool-for-c/1205623#1205623
Ruben Bartelink
yeah he posted it like 3 seconds before i did :)
Mladen Prajdic
Yes, and the same happens to many Fastest Guns In The West, me included. When it happens to me, I delete mine unless I feel I'm adding something deeper than the very fastest gun in the west was saying.
Ruben Bartelink
Given a person should not knowingly duplicate another answer. Also if an answer is duplicated within a reasonable time scale that should probably be removed as well. But if 4 different people give the same answer within a minute of each other, I believe it gives the original questioner more information and a higher degree of 'question answered' belief than 1 answer upvoted 4 times, therefore the answer should remain.
Paul Rowland
@Paul: That doesnt make much sense to me. Is code clearer if you just copy and paste 4 copies of something than have everyone go to the effort of consolidating stuff into functions? I have no problem trusting votes on da interwebs. I wouldnt mind if there were subtle differences between the two posts, but in this case we have "what you probably need is" which as a questioner would make me less certain as to whether this is appropriate for me _and why_. But its an opinion thing, and one more than one occasion I have deleted FGITW dups - even upvoted ones in some cases.
Ruben Bartelink
Maybe I was just having a tectchy fight the world day yesterday tho' -- http://stackoverflow.com/questions/1205329/c-var-keyword-usage/1205346#1205346 still baffles me too!
Ruben Bartelink
@Ruben, I disagree with your code analogy! How about if you have 4 people in front of you, ask them whats the capital of Mongolia, they all blurt out Ulan Bator at the same time. I would be very sure of the answer. What if they look at each other for a few secs, then one says its Ulan Bator, then the others say, yeah I agree with him. Are you more or less sure of the answer?
Paul Rowland
+10  A: 

In .NET, API documentation is built-in and an XML-file is automatically generated from the source code (via XML-comments). This documentation is used by Visual Studio for the Intellisense documentation. You can use a tool like Sandcastle to convert these XML-files to CHM, or HTML, or a different format.

Tommy Carlier
+1 for Sandcastle, and I'd like to add that the "sandcastle help file builder" (SHFB) that adds a GUI to it is indispensable: http://www.codeplex.com/SHFB
KristoferA - Huagati.com
+1  A: 

GhostDoc to generate the XML

Sandcastle to generate the documentation.

Paul Rowland
Dup of http://stackoverflow.com/questions/1205621/whats-the-most-widely-used-documentation-tool-for-c/1205655#1205655
Ruben Bartelink
+4  A: 

Use Sandcastle in conjunction with GhostDoc, which is a nice VS addin to make it easy to comment and document.

"GhostDoc is a free Visual Studio extension that automatically generates XML documentation comments for methods and properties based on their type, parameters, name, and other contextual information.

When generating documentation for class derived from a base class or for interface implementation (e.g. .NET Framework or your custom framework), GhostDoc will use the documentation that Microsoft or the framework vendor has already written for the base class or interface."

Dan Diplo
A: 

An alternative to GhostDoc is my AtomineerUtils addin. It's also free, but much more powerful, flexible and configurable.

Jason Williams
+3  A: 

GhostDoc to easily create the comments. (I try not to abuse it though)

Doxygen to create a set of html documentation files. Doxygen is great because it can map out the relationship between classes such as which class uses another and which class inherits from another (C++ example). For the most part Doxygen was created for C++ but it can handle C# comments as well. It's handy for exploring the architecture of foreign code, assuming they bothered to put in decent documentation.

Darwyn
I have found doxygen to be an excellent alternative to Sandcastle for C# code. It's also at least one order of magnitude faster than sandcastle.
Todd Stout
+1  A: 

I use GhostDoc for code documentation (it will provide you with a basic template, you would have to expand on it). I was really surprised when using DOxygen + graphviz . It can automatically generate your class diagrams/inheritance diagrams and collaboration diagrams. And you can click on these diagrams to navigate between classes. beautiful. Additionally you have the option to include your C# source code which makes cross referencing very easy. Each property/method has a reference line number in the source file and clicking on it takes you exactly to that line, rather than doing a search on the source file for that particular method/property

ram
A: 

The Live Documenter is another alternative. Its still pretty new at the moment and allows you to view your XML code documentation live. They are currently working on exporting ala NDoc and Sandcastle. Looks really good though.

http://theboxsoftware.com/products/live-documenter/

It's free for non-commerical use.

Barry Jones