Comments in C#
You can easily add comments within the structure of your C#. Comments are used to help document what a program does and what the code with it does. Keep the comments simple and direct . It is used for formal documentation for understanding particular code and its operation. There are three ways of commenting in C#.
- Single Line Comment
- MultiLine Comment
- XML documentation comment
Single Line Comment
The single line comment is specified using the symbol // Example
// This is a single line comment in C#.
MultiLine Comment
The Multiline comment can be specified using the symbol /* */ Example
/* This is an example of
multiline comment in c#*/
XML documentation comment
This is a special kind of comment which is generally used for API documentation. The XML
documentation comment can be specified using the symbol /// Example
/// use to specify the XML comments in c#
Note - we can use Ctrl+K, Ctrl+C and Ctrl+K, Ctrl+U to Comment or Uncomment selected lines in C#.
Related Topics
- Does C# support multiple Inheritance ?
- What is Process ID ?
- How do I make a DLL in C# ?
- How many ways you can pass values to Windows Services ?
- Can we use "continue" statement in finally block ?
- What is nullable type in c# ?
- Difference between the Debug class and Trace class ?
- What is lock statement in C#
- What are dynamic type variables in C#
- What is the difference between is and as operator in C#?
- What are circular references in C#?
- What are the differences between events and delegates in C#
- Explain the types of unit test cases in C#?
- What are the various ways to pass parameters to a method in C#?
- What are the different ways to deploy a assembly in net?
- What does assert() method do in c#
- What is literals in C# - Constants and Literals
- What is the use of goto statement in C#
- How can JIT code be faster than AOT compiled code
- Why events have no return types in .NET
- What's the difference between a static method and a non-static method in C#
- What's a weak reference c#?
- What is C# equivalent of the vb.net isNothing function
- What are indexers in C#
- What are generics in c#