A few unknown Visual Studio coding tips in C # to share _c# tutorials

Source: Internet
Author: User

It took years of visual Studio to discover this coding technique today, and it's a shame to share it.

Development environment: Vs2010+c#

1, code refactoring new class

If you're still like me. Use the right-click shortcut menu to create a new class, which is too out. VS, the "New Item dialog" comes out very slowly and affects your mood.
When you find that you need to define a class, the correct approach is:
1 define the class name at the current code, such as:list<newclass> ls;
2 Focus move to Newclass, press CTRL +. ("point")
3) Carriage return.
So the class is built. This method also applies to the class's methods, properties, fields, rename field method names, and so on

2. Extraction Method

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

3. Insert Shortcut phrase

Quickly define dependency properties
1) Input PROPD
2) Quick Press two times tab key
3 Enter in the selected area, press the TAB key to switch to the next area, complete the return.
In fact, just inserted a shortcut code phrase SNIPPET,VS can be defined, through the "Tools" menu => code Snippets Manager.

4. Other shortcut keys

Quick Switch Tab: Ctrl+tab
Jump to the beginning or end of a word: Ctrl + LEFT ARROW
Full screen editing code: Shift+alt+enter
Pull up Immediate window: ctrl+alt+i

Many shortcut keys, you can reduce the mouse keyboard switching back and forth, effectively save coding 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.