Labels: Visual Studio
1. Todo: bookmarks
After opening it, return to the position of the previous job, so that we no longer use our brains to remember the work we just got.
The operation is simple, as shown in the following code:
Public datatable selectbycaid (string CAID) {// todo: retrieve all news datatable dt = new datatable (); string cmdtext = "news_selectbycaid "; sqlparameter [] paras = new sqlparameter [] {New sqlparameter ("@ Caid", CAID)}; dt = sqlhelper. executequery (plain text, paras, commandtype. storedprocedure); Return DT ;}
Click Edit-task list to locate each todo place as a bookmarkdonefile.
2. Code Template
After you press for in the Code and press TAB twice in a row, the following appears:
for (int i = 0; i < length; i++){ }
You only need to change the variable name and condition.
Similarly, if and foreach can all be implemented in this way. It is convenient and quick, greatly improving the efficiency.
3. Comments
Three slashes (three quotation marks in VB)
Region... # Region
The Section enclosed by region... # region is folded as follows, so that we can check the code and it will be neat.
Automatically generate a header
Find in vs (the installation drive letter uses drive C as an example) c: \ Program Files \ Microsoft Visual Studio 10.0 \ common7 \ ide \ itemtemplatescache \ CSHARP \ code \ 2052 \ class.zip
Add the following code to the class. CS file.
/*************************************** **************************************** ******
* CLR version: $ clrversion $
* Class Name: $ itemname $
* Machine name: $ machinename $
* Namespace: $ rootnamespace $
* File name: $ safeitemname $
* Creation Time: $ time $
* Author: XXX
* Modification time:
* Modifier:
**************************************** **************************************** *****/
4. Insert common code segments
Select the code you want to reuse, drag it to the Toolbox on the left, find the part of the code you want to use, and drag it over.
To facilitate search and differentiation, it is best to rename and reflect the functions of each code.
5. Start execution without debugging
If you want to see the final result instead of the intermediate result, you can use "start execution without debugging" instead of breakpoint debugging.
6. Organize the code format
Shortcut Key CTR + k, CTR + d
Good at discovering and using these skills can improve our work efficiency. This awareness of serving the people is what we need to learn all the time.
Visual Studio skills