注释用来对编写的代码进行说明,包括功能说明以及实现说明,这样可以大大的提高程序的可读性,另外规范的注释还可以通过工具来生成相应的API文档,C#的注释规范有以下几种:
    类注释
    例:

    1. /// <summary>
    2. /// This is a Entity Class for Post.
    3. /// </summary>
    4. public class Post

    属性及方法注释:

    1. /// <summary>
    2. /// Get post with id
    3. /// </summary>
    4. /// <param name="id">post's identity</param>
    5. /// <returns>post instance</returns>
    6. public Post GetPostById(int id)

    代码单行注释:

    1. //this is a single line comment

    代码多行注释:

    1. /*
    2. this is comment1
    3. this is comment2
    4. */