C# Comments Tutorial with Examples

C# Comments Tutorial with Examples

Today, We want to share with you C# Comments Tutorial with Examples.
In this post we will show you C# Comments, hear for c# comments best practices we will give you demo and example for implement.
In this post, we will learn about C# Programming/Syntax with an example.

My Paka Knowledgeable Ideas, Tips and Tricks, Useful Content, Jobs, Technology, Earn Money, gmail creation, skype, yahoo and more useful things.

Introduction: C# Comments

In this post, we will learn about C# Comments C#.Net with an example.

The C# comments are statements or lines of code that are not executed by the compiler. The comments in C# programming are used to provide explanation of the code, variable, method, logic of codes or class.

There are two types of comments in C#.

  • Single Line comment
  • Multi Line comment

C# Single Line Comment

The single line comment starts with // (double slash). Let’s see an example of single line comment in C#.

using System;  
   public class CommentDemo  
    {  
       public static void Main(string[] args)  
        {  
            int _max = 15;//Here,is max variable 
            Console.WriteLine(x);  
            Console.ReadLine();
        }  
    }  

C# Multi Line Comment

The C# multi line comment is used to comment more than one line of code. It is surrounded by slash and asterisk (/* ….. */). Let’s see an example of multi line comment in C#.

using System;  
   public class CommentExample  
    {  
       public static void Main(string[] args)  
        {  
            /* Let's declare and  
          print variable in C#. This is multi line comment */   
            int x=20;  
            Console.WriteLine(x);  
        }  
    }  

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about How to comment multiple lines with space or indent in C#.I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.