What is the difference between /// and #region in c#?

后端 未结 8 1972
隐瞒了意图╮
隐瞒了意图╮ 2021-02-13 03:57

What is the difference between ///

and #region ...#endregion statements in c#? Which one the best?

8条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-13 04:27

    /// 
    /// Three forward slashes denote a documentation comment, which can be used in
    /// conjunction with documentation tooling to generate API documentation for
    /// your code.
    /// 
    
    // two forward slashes denote a code comment, which you can use to provide
    // commentary within your code
    
    /*
    This style of comment is called a block comment, which can be used to easily
    comment out large blocks of text within your code
    */
    
    #region Some Region Name
    
    // the above region allows the developer to collapse/uncollapse everything
    // within it, as long as their IDE supports regions
    public void SomeMethod()
    {
    }
    
    #endregion
    

提交回复
热议问题