XML in Csharp code?

  • Thread starter Thread starter ozgur develioglu
  • Start date Start date
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?
 
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.
 
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
 
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
 
Back
Top