How to quickly batch-generate the Get and set methods of a property with visual Studio development tools

Source: Internet
Author: User

Two ways:

1 First define a private variable in the class: private int number = 0; Then the mouse is placed on the defined statement and the right button selects "Refactor-Encapsulate Field" (Ctrl+r E).

2 If you use VS2010 (non-Express version), you can also download the plugin, which supports batch generation

Aseclipse Download Address: http://visualstudiogallery.msdn.microsoft.com/99ede732-544c-4f3b-8e38-49e4b8395075 support VS2005, VS2008, VS2010 Chinese-English version
Aseclipse is porting some of the Eclispe handy editing features to Visual Studio. And make the shortcuts as far as possible consistent with the Eclipse default settings. Whether you've used eclipse or not, it's easy to write your code.

Mainly include:
1 shortcut keys perform code collation: Ctrl+shift+f (C # only)
2 one-time rapid generation of all Getter/setter properties: Alt+shift+s, R (especially convenient for data classes, support only C #)
3 Show type outline form, and then go To Definition: ctrl+shift+t (if you have too many types, show only recently edited types, support C #, C + +)
4 show the member outline form for the currently edited document, and then go to the definition: Ctrl+o (support C #, C + +, VB)
5 Insert Code Snippet function: Alt+shift+z (invoke vs Insert Snippet function)
6 Code snippet Annotation/uncomment function: ctrl+/(if the selected code is commented out, perform a cancellation comment, otherwise execute the annotation, support C #, C + +, VB, XML)
7 In document Edit tab, add close all document menu: CTRL+SHIFT+F4
8 count lines of code, click on the main Menu: Tool-aseclipse-codelinecounter, you can.
9 You can customize the shortcuts for those features above through the Aseclipseconfig.xml file. Aseclipseconfig.xml and AsEclipse.dll are in the same directory. If you want to restore the default settings, delete the Aseclipseconfig.xml directly.
------------------
Attention:
1. After the installation is complete, will be in the main menu under "Tools--aseclipse" See all the features of this plug-in.
2. All functions can be easily completed on the keyboard, do not need to use the mouse. Can greatly reduce the number of times you use the mouse, whether it is to open a file, open a class, or positioning to methods, variables, etc., can be achieved by keyboard.
3. Some of the features are vs., Aseclipse just set some shortcuts to it.
4. About the display type outline: When a solution is open, the plug-in indexes the type in the solution, has more files, is slower to index, and automatically switches to show all types of the most recently edited file when there are too many types. When the user executes the Rebuild Solution command (Rebuild All), the index is rebuilt.
5. There is currently no test for compatibility with other plug-ins.
6.aseclipseconfig.xml is generated the first time that you start Visual Studio when you have installed this plugin.
------------------
Installation instructions: Insert the plug-in DLL and. The addin configuration file is placed in the Visual Studio 2008 application directory (the default is My Documents \visual Studio 2008 (or 2005, 2010)) in the AddIns directory。 If there is no AddIns directory, create one yourself. Finally, restart Visual Studio. If you are 2005 the replacement directory is replaced with 2005 accordingly.
If you do not find the Aseclipse menu under the Tools menu after confirming the correct installation, you will need to reboot vs.
------------------
Delete method: Delete DLL and configuration file.

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.