What are the shortcuts for sorting code and comments in VS2008?


When writing c# programs in VS2008, the code is often confused accidentally, or when copying other people’s code, the format of the code is not standardized. In reading the SDK written by some companies, the style of the code is basically the same, and the folding and annotation give people a very fresh feeling. In actual projects, a project is often large and needs many people to write, so good reading of the code is extremely important, and you need to master the shortcut keys to sort out the code.

1. Formatting messy codeShortcut key ctrl+k+f, select the disordered text and press the shortcut key.

2. Code folding, folding up some code that doesn’t need to be analyzed and changed, allows programmers to focus most of their energy on the parts that need debugging and analysis.In VS2008, \region and \endregion are used, put the code that needs to be folded into it, and press the shortcut keyctrl+M+M, you can fold and open

3. Good code must be commented, vs annotates the method by entering / / / / on the method, and a series of things will appear automatically, /// <summary>, just add notes.

4. Multiple lines of comments will affect reading if they are not folded. You can fold them up. Here, use another annotation method, enter / / above the annotation code, and multiple lines will start another line / /, and then the samectrl+M+M,Fold it up.

Relevant recommendations:

How to do code analysis in vs2013?

How can vs2013 avoid loading symbols when debugging code?

What should I do if the set shortcut keys are not easy to use after the crash of VS2010?

Recommended Today

C # multithreading method for processing multiple data

catalogue summary code implementation Code address summary Multithreading refers to the technology of realizing the concurrent execution of multiple threads from software or hardware. Computers with multithreading capability can execute more than one thread at the same time due to hardware support, thereby improving the overall processing performance. Systems with this capability include symmetric multiprocessors, […]