Full width home advertisement

Post Page Advertisement [Top]

Why To Use Comments

The comments are added into the source code inorder to provide some specific description regarding the code. In Most of the enterprise level software development companies there are guide lines on usage of comments.


Types Of Comments

  1. Single-line Comment 
  2. Multi-line Comment 
  3. Documentation Comment 
Single Line Comments : The single line comments are supposed to be used if the comment is small.

Eg: // Sample Comment

Multi Line Comments : They are used if the comment data is huge and are used as shown in the example bellow.

Eg: /* sample
           Multiline Comment */

Documentation Comment : They are used for the purpose of documentation, what ever we write here will be parsed and document regarding the class will be created..We can describe the input parameters and API declarations.
Eg:     ///
           ///
         

Example Of Comments


/*
* Created on June 16, 2018
* Comment in c#
*/

using System;
using Alias = System.Console;
namespace SampleProject
{
public class MyClass
{
/// <summary>
/// </summary>
/// <param name="args"></param>
public static void Main(string[] args )
{
// print a message
Alias.WriteLine("Welcome to C# !");
}
}
}

No comments:

Post a Comment

Bottom Ad [Post Page]