TEP , The Engineering Projects , Author Welcome! Syed Zain Nasir Mechatronics Engineer TEP , The ENgineering Projects , TEP Badge TEP , The Engineering Projects , Ratting Background 7.5 7.5/10
TEP , The Engineering Projects , Rating Percentage Background Reputation Score 55 / 100
How to use C# Comments, c# comments, comments in c#, comments c#, comments in c#
TEP , The Engineering Projects , Boxes

How to use C# Comments ???

TEP , THe Engineering Projects , Shares 2.5K Views
TEP , The ENgineering Projects , Reaction 40
TEP , The ENgineering Projects , Reaction 700
TEP , The ENgineering Projects , Reaction 60
TEP , The ENgineering Projects , Reaction 25
TEP , The ENgineering Projects , Reaction 60
TEP , The Engineering Projects , Pintrest TEP , The Engineering Projects , Pintrest TEP , The Engineering Projects , Pintrest TEP , The Engineering Projects , Pintrest TEP , The Engineering Projects , Pintrest
Shares: 691
TEP , The Engineering Projects , PCBWAY

How to use C# Comments, c# comments, comments in c#, comments c#, comments in c#
Hello everyone, I hope you all are fine and having fun. Today's tutorial is a quick one and is about how to use C# Comments. Comment is an important part of any programming language, although its not a directly part but they indirectly help a lot especially in complex projects.

I have also shared a tutorial on How to use comments in c++, you should read that post as well because I have explained few basic concepts in it. You guys are also welcome to give us feedback about this new C# tutorial series. If you have any suggestions about it then do let us know in comments.

How to use C# Comments ???

  • Comments are simple documented text lines, completely ignored by the compiler and are used to explain or provide any additional information about coding.
  • There are 3 types of comments available in C#, which are:
    • Single Line Comments. ( Symbol used: // )
    • Multi-Line Comments. ( Initial Symbol: /* Closing Symbol */ )
    • XML Documentation Comments. ( /// )
  • Now, let's have have look at each one of them in detail:

Single Line Comments

  • Single Line Comments are used to comment any text in a single line, we have to place two forward slashes ( // ) and everything after that will be ignored by the compiler.
  • Let's have a look at How to use Single Line Comments, in below figure:
How to use C# Comments, c# comments, comments in c#, comments c#, comments in c#
  • You can see in above figure, that I have used green comments above each block to explain my code i.e. mentioning 2D & 3D arrays, accessing array elements etc.
  • Moreover, I have also used comments in front of the line i.e. displaying data at location 0, 0 etc. In this case, I am just explaining a single line.

Multi-Line Comments in C#

  • We can also comment out multiple lines by using /* */ these symbols.
  • Let's say, you don't want to execute some part of your code i.e. 100 lines, then it would be too difficult to place // these symbols in front of each line.
  • In such cases, there's a need for Multi-Line Comments, here's an example:
How to use C# Comments, c# comments, comments in c#, comments c#, comments in c#
  • At the top of above code, you can see I have used Multi-Line Comments to give a simple introduction, here you can also add description of your project/code.
  • Moreover, I have also commented out Console code, I just want output using For Loop and I have used Multi-Line Comments for that.

XML Documentation Comments

  • In Microsoft Visual Studio, when you hover your cursor on any object then it pops up an info box.
  • If you want to add any information in this pop up box then you need to use XML Documentation Comments, as shown in below figure:
How to use C# Comments, c# comments, comments in c#, comments c#, comments in c#
  • In the above code, I have created a new class named TEPClass, we will discuss classes later in detail, but for now just focus on XML comment above that class.
  • In Program class, I have called TEPClass and now when I hover my cursor over it, you can see a pop up box appeared and it has that XML comment in it.
  • I have placed a red arrow in front of it, here we can place a short description of our class.

Why we need to use C# comments ???

  • Let's say you have to use some old code which you have designed a year ago.
  • Now when you read your own code after a year, it will be difficult to understand.
  • But if you have placed some check note (comments) for each command then you can easily understand it.
That's all for C# comments. I hope you guys have understood how & why we need to use C# Comments. In next tutorial, we will have a look at How to use If Loop in C#.
TEP , The Engineering Projects , Tags
How to use C# Comments
c# comments
comments in c#
comments c#
comments in c#
TEP , The Engineering Projects , Calender Tuesday, June 7, 2016
TEP , The Engineering Projects , Comments

Write a Comment

TEP , The Engineering Projects , WordPress TEP , The Engineering Projects , Google TEP , The Engineering Projects , Twitter TEP , The Engineering Projects , Facebook TEP , The Engineering Projects , User
TEP , The Engineering Projects , Robot
TEP , The Engineering Projects , Comments Comments on ‘’ How to use C# Comments ??? ‘’ (1)
TEP , The Engineering Projects , Comment
TEP , The ENgineering Projects , Reaction 40
TEP , The ENgineering Projects , Reaction 700
TEP , The ENgineering Projects , Reaction 60
TEP , The ENgineering Projects , Reaction 25
TEP , The ENgineering Projects , Reaction 60
It is information that I did not know, good post helps me a lot for my university work, I study communication at https://www.ups.edu.ec/ and I would like to receive more information of this type I hope to continue forward and help many people like I... Thank you!
TEP , The Engineering Projects , About TEP , The Engineering Projects , About Shadow

Top PCB Design Service

PCBA
TEP , The Engineering Projects , JLCPCB
PCB
TEP , The Engineering Projects , JLCPCB
TEP , The Engineering Projects , About TEP , The Engineering Projects , About Shadow

Embedded Tools

ARDINO TEP , The Engineering Projects , JLCPCB
TEP , The Engineering Projects , About TEP , The Engineering Projects , About Shadow

Subscribe Now !!!

Learn Free Pro Tricks

TEP , The Engineering Projects , Mail Receive Quality Tutorials Straight in your Inbox by Submitting your Email ID Below
TEP , The Engineering Projects , Mail TEP , The Engineering Projects , Mail Shadow
TEP , The Engineering Projects , Mail Robot TEP , The Engineering Projects , Mail Robot Shadow TEP , The Engineering Projects , Mail Robot Shadow
TEP , The Engineering Projects , About TEP , The Engineering Projects , About Shadow

Engineering Books

TEP , The Engineering Projects , Arduino Programming Book
SALE $20
Text Book for arduino $20
TEP , The Engineering Projects , Rating Stars (5.0)
TEP , The Engineering Projects , Arduino Programming Book
SALE $20
Text Book for Raspberry Pi $20
TEP , The Engineering Projects , Rating Stars (3.0)
TEP , The Engineering Projects , Arduino Programming Book
SALE $20
Text Book for arduino $20
TEP , The Engineering Projects , Rating Stars (4.7)
TEP , The Engineering Projects , Arduino Programming Book
SALE $20
Text Book for Raspberry Pi $20
TEP , The Engineering Projects , Rating Stars (5.0)
TEP , The Engineering Projects , TEP Robot TEP , The Engineering Projects , TEP Robot Shadow TEP , The Engineering Projects , TEP Robot Shadow
TEP , The Engineering Projects , About TEP , The Engineering Projects , About Shadow

Categories

TEP , The Engineering Projects , Arduino
TEP , The Engineering Projects , Notification 20K
TEP , The Engineering Projects , Tick 900
TEP , The Engineering Projects , Views 900
TEP , The Engineering Projects , Comments 20K
TEP , The Engineering Projects , Arduino
TEP , The Engineering Projects , Notification 20K
TEP , The Engineering Projects , Tick 900
TEP , The Engineering Projects , Views 900
TEP , The Engineering Projects , Comments 20K
TEP , The Engineering Projects , Arduino
TEP , The Engineering Projects , Notification 20K
TEP , The Engineering Projects , Tick 900
TEP , The Engineering Projects , Views 900
TEP , The Engineering Projects , Comments 20K
TEP , The Engineering Projects , Arduino
TEP , The Engineering Projects , Notification 20K
TEP , The Engineering Projects , Tick 900
TEP , The Engineering Projects , Views 900
TEP , The Engineering Projects , Comments 20K
TEP , The Engineering Projects , Arduino
TEP , The Engineering Projects , Notification 20K
TEP , The Engineering Projects , Tick 900
TEP , The Engineering Projects , Views 900
TEP , The Engineering Projects , Comments 20K