Commenting and un-commenting your code

Goal

In this tutorial you will learn how to quickly comment and un-comment your code using Visual Studio.
Commenting and un-commenting your source code

Visual Studio gives you a very handy feature to quickly comment and un-comment multiple lines of code. For example let’s say you have a function in your code which you are not using anymore but you do not want to delete it thinking that it might be required in future. The easiest way to keep the function in your code is to comment it. But it might become difficult for you to comment hundreds of lines of code one by one. This is where you can use the commenting and un-commenting feature of Visual Studio to quickly comment your code.

Look at the animated image below

Commenting and uncommenting your code in Visual Studio
 
Here you can see how we select the method and comment it and then un-comment it using Visual Studio. You can use the same technique to comment and un-comment any code inside Visual Studio

Shortcuts to commenting and un-commenting

You can also use the following shortcuts to comment and un-comment code inside Visual Studio

Comment – Ctrl + E + C
Un-comment – Ctrl + E + U

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp