Vs small plug-in -- Automatic property Generator

Source: Internet
Author: User

For "dependency injection", the most common method is "Set Value injection" (that is, injection through the setter attribute). For classes that require many dependencies, the complexity of manually writing attributes one by one has left me intolerable. So I wrote a small vs2003 plug-in. You only need to enter the type and attribute name to automatically generate attributes at the place specified by the editor, and multiple attributes can be generated at a time. (I tried the property auto-generated function in vs2005, and it is not that easy to use :))
After this plug-in is installed, a menu item "propertycreatoraddin" will appear at the top of the shortcut menu of vs2003 right-click ":

Click this menu and the following window will appear:

For example, if you enter "int connectioncount, string servername" in the textbox of "attribute string" and click "generate", the following code is generated in the Editor:

# Region connectioncount
Private int connectioncount = 0;
Public int connectioncount
{
Get
{
Return this. connectioncount;
}
Set
{
This. connectioncount = value;
}
}
# Endregion

# Region servername
Private string servername = "";
Public String servername
{
Get
{
Return this. servername;
}
Set
{
This. servername = value;
}
}
# Endregion


Note the following when entering the attribute string:
(1) type and attribute names are separated by a space.
(2) If multiple attributes need to be generated, each attribute is separated by a comma (, as in the example ).
(3) The two checkboxes on the plug-in interface are used to control the "read-only" attribute and "Write-only" attribute.

Download the propertycreatoraddin Installer

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.