Several unknown Visual Studio coding tips in C # share

Source: Internet
Author: User
After many years of visual Studio, today only to find this coding skills, it is really ashamed to share, it is a tip!

Development environment: Vs2010+c#

1. Code refactoring new Class

If you use the right-click shortcut menu to create a new class like I used to, it's out of the way. VS's That "New Item dialog" comes out very slowly and affects the mood.
When you find that you need to define a class, the correct method:
1) Define the class name at the current code, e.g.:list<newclass> ls;
2) Focus moves to Newclass, press CTRL +. ("point")
3) Enter.
So the class is built. This method also applies to methods, properties, fields of a class, rename field method names, and so on.

2. Extraction method

Sometimes we find ourselves always writing the same piece of code, we can extract a method, how to do it? Do it with me.
1) Do not use the mouse to select our code
2) Press Ctrl+r and press M (note that this is a two-time press)
3) Enter the method name in the pop-up dialog box, return

3. Insert a shortcut phrase

Quickly define dependency properties
1) Input PROPD
2) quickly press two times TAB key
3) in the selected area, press the TAB key to switch to the next area, and enter after completion.
Actually just inserted is a shortcut code phrase Snippet,vs can define itself, through the "Tools" menu and the code Snippet manager.

4. Other shortcut keys

Quick Switch Tab: Ctrl+tab
Jump to the beginning or end of a word: Ctrl + Left and right arrows
Full screen editing code: Shift+alt+enter
Bring up the Immediate window: ctrl+alt+i

More will be some shortcut keys, you can reduce the mouse keyboard to switch back and forth, effectively save the encoding time.

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.