CreateProperty Add-In

A few days ago I posted about writing properties. I got a couple interesting and thought provoking comments from Dennis Webb about how it would be nice if:

  1. We didn't have to declare private member variables for properties, essentially saying let the compiler determine that one is needed and inject it into the IL where appropriate, or
  2. If that's not possible, have the IDE auto-generate the private member variables for us

Of course, this got me thinking and since I can't do much about #1, I can do something to address #2. I've been wanting to play around with creating an add-in for Visual Studio anyway, and this gave me the right opportunity to do that. So I spent a few hours and built an add-in named “CreateProperty Add-In” for Visual Studio .NET 2003.

The add-in will auto-generate properties for you and if you'd like, it's private member variable as well. It works for VB.NET and C#, so give it a try and let me know what you think. The download is free and comes with all source code.

Even if this isn't a huge benefit to people, it was *fun* to go through the exercise of building the add-in. I learned some things along the way that I'll post soon because building an add-in is a different beast.

Print | posted on Wednesday, November 17, 2004 8:01 AM

Feedback

# re: CreateProperty Add-In

left by Kelly D. Jones at 11/17/2004 10:25 AM
Great little utility. I definitely will be using it. However, my VS seems to autocomplete the Property text and I end up with two copies of gets and sets. Have you seen this? - kdjones74@hotmail.com

# re: CreateProperty Add-In

left by Brendan Tompkins at 11/17/2004 11:51 AM
Good work!

# re: CreateProperty Add-In

left by Dennis Webb at 11/18/2004 6:48 AM
Thanks Dave! You Rock! I will be using this utility as well. I will also let the other developers where I work know about it.

Yet another example of the power of blogging...

# Visual Studio Plug-in

left by Dennis Webb at 11/18/2004 6:59 AM

# re: CreateProperty Add-In

left by Kelly D. Jones at 11/18/2004 6:20 PM
Dave -- my bad. My previous comment covered an issue that you documented in the readme. Cool utility.

# Add-In Tips

left by Dave Donaldson's Blog at 11/21/2004 3:47 PM

# re: CreateProperty Add-In

left by Joe at 3/7/2005 9:25 AM
Nice utility. I was thinking how great it would be if I could define my member variables, highlight those then run the CreateProperty utility which would generate the Properties from the member variable definitions selected.

However the tool as it stands is pretty good, just one small annoyance:

If I choose to auto-generate the member variable for a property I have to explicitly give the member variable a name, or it will defaut to m_Property1 for example. It would be much better if it defaulted to something like m_<property name>.

Regards,

Joe.

# re: CreateProperty Add-In

left by Dave at 3/7/2005 12:42 PM
Joe - thanks for the comment. The annoyance you mention is something I've been meaning to fix, but just haven't gotten around to yet. Now that I know more than a couple people are using it, I'll try to get it taken care of.

# re: CreateProperty Add-In

left by 尖锐湿疣 at 6/27/2005 11:08 PM
It's cool.

# re: CreateProperty Add-In

left by GOOGLE排名 at 8/14/2005 11:38 PM
I have already read

# re: CreateProperty Add-In

left by Jay at 10/26/2005 1:55 PM
the url is broken, can you please fix the link?
thanks!
Comments have been closed on this topic.