How to quickly generate the get and set methods of attributes in batches using Visual Studio

Source: Internet
Author: User

Two methods:

1) first define a private variable in the class: Private int number = 0; then place the cursor over the defined statement, right-click reconstruction and choose "encapsulate field" (CTRL + r e ).

2) if you use vs2010 (non-Express version), you can also download the plug-in, which supports batch generation.

Aseclipse: http://visualstudiogallery.msdn.microsoft.com/99ede732-544c-4f3b-8e38-49e4b8395075

Supports the Chinese and English versions of vs2005, vs2008, and vs2010.
Aseclipse migrates some convenient editing functions of eclispe to Visual Studio. Make the shortcut key consistent with the default eclipse settings. No matter whether you have used eclipse or not, it is easy for you to write your code.

It mainly includes:
1. Run the Code with the shortcut key: Ctrl + Shift + F (only C # is supported #)
2. generate all getter/setter attributes quickly at one time: Alt + Shift + S, R (especially convenient for data classes, only C # is supported #)
3. display the type outline form. After selection, go to the definition: Ctrl + Shift + T. (if there are too many types, only recently edited types are displayed. C # And C ++ are supported)
4. display the member outline form of the currently edited document. After selecting the form, go to the definition: Ctrl + O (C #, C ++, and VB supported)
5. Insert a code segment: Alt + Shift + z (called vs's insert code segment function)
6. code snippet comments/uncomment: Ctrl +/(if the selected code is commented out, cancel the comments; otherwise, run the comments, supports C #, C ++, VB, and XML)
7. On the document editing tab page, add the "close all documents" menu: Ctrl + Shift + F4.
8. count the number of lines of code. Click the main menu: tool-aseclipse-codelinecounter.
9. You can use the aseclipseconfig. xml file to customize the shortcut keys for the above functions. Aseclipseconfig. xml and aseclipse. dll are in the same directory. If you want to restore the default settings, delete aseclipseconfig. xml directly.
------------------
Note:
1. After the installation is complete, all functions of this plug-in will be displayed under "tools -- aseclipse" in the main menu.
2. All functions can be easily completed on the keyboard without using the mouse. It can greatly reduce the number of times you use the mouse. You can use a keyboard to open a file, open a class, locate methods, variables, and so on.
3. Some functions are provided by vs. aseclipse only sets some shortcut keys for it.
4. about display type outline: when the solution is opened, the plug-in will create an index for the type in the solution. There are many files and the indexing speed will be slow. When there are too many types, automatically switches to display only all types of recently edited files. When you execute the rebuild all command, the index is re-created.
5. the compatibility with other plug-ins has not been tested.
6. aseclipseconfig. XML is generated when Visual Studio is started for the first time after you install this plug-in.
------------------
Installation instructions: add the plug-in DLL and. addin configuration files to the Visual Studio 2008 application directory (By defaultUnder the addins directory of my document \ Visual Studio 2008 (or 2005, 2010). If the addins directory does not exist, create one by yourself. Finally, restart the visual
Studio. If you use 2005, replace the directory with 2005.
If you cannot find the aseclipse menu under the tool menu after confirming the correct installation, You need to restart.
------------------
Delete method: Delete the 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.