XML in Csharp code?

O

ozgur develioglu

Why do you use XML code in c# code like;
/// <summary>

/// Execute a SqlCommand (that returns no resultset) against the database
specified in the connection string

/// using the provided parameters

/// </summary>

/// <remarks>

/// e.g.:

/// int result = ExecuteNonQuery(connString, CommandType.StoredProcedure,
"PublishOrders", new SqlParameter("@prodid", 24));

/// </remarks>

/// <param name="connectionString">A valid connection string for a
SqlConnection</param>

/// <param name="commandType">The CommandType (stored procedure, text,
etc.)</param>

/// <param name="commandText">The stored procedure name or T-SQL
command</param>

/// <param name="commandParameters">An array of SqlParamters used to execute
the command</param>

/// <returns>An int representing the number of rows affected by the
command</returns>

What do they serve?
 
J

Jack Meyhoff

Its for automatic documentating, you can auto generate docuementing for APIs
and class libraries in various forms by running it thru a style sheet, want
HTML , not a problem. Its a good thing. Use it.
 
W

Wim Hollebrandse

In addition to what Jack mentioned - check out the free Ndoc utility which
generates MSDN style documentation based on your C# XML comments.

You can find it at: http://ndoc.sourceforge.net/

Cheers,
Wim Hollebrandse
 
N

Noah Coad [MVP & MCP]

And the most obvious (and quick result) reason...
The VS.NET IDE shows those commend when you use the class and AutoComplete.

You've seen documentation when using a class and pressing "." after it, like
this:
Console.WriteLine(
Well the IDE will use those XML comments to do the same with your code.

-Noah Coad
Microsoft MVP & MCP
 
J

Jack Meyhoff

Its called "intellisense".


Noah Coad said:
And the most obvious (and quick result) reason...
The VS.NET IDE shows those commend when you use the class and AutoComplete.

You've seen documentation when using a class and pressing "." after it, like
this:
Console.WriteLine(
Well the IDE will use those XML comments to do the same with your code.

-Noah Coad
Microsoft MVP & MCP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top