Visual Studio skills

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.