C Sharp/注釋方法

維基教科書,自由的教學讀本

C#允許三種寫注釋的方法:

單行注釋
//開始直至行末
多行注釋
/*開始直至*/結束。
// This style of a comment is restricted to one line.
/* 
   This is another style of a comment.
   It allows multiple lines.
*/
XML文檔-行注釋
用於生成XML文檔。細分為///開始的單行風格,以及/***/之間的多行風格.
/// <summary> documentation here </summary>
/// <remarks>
///     This uses single-line style XML Documentation comments.
/// </remarks>


/** 
 * <summary> documentation here </summary>
 * <remarks>
 *     This uses multiple-line style XML Documentation comments.
 * </remarks>
 */