Derik Whittaker



Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at
Nice side affect of Automatic Properties

Today it dawned on me another nice little side affect of automatic properties.

I was creating an interface today that ONLY had properties and when I was done I needed to create the concrete object that implemented said interface.  All I had to do was copy, paste and add the modifier (public) to each line. 

In the past I would have had to create the private member variables and setup the formatting correctly.  Now I do not have to.  Saved me a solid 5 minutes of busy work.

+1 for saving me time.

Till next time,

Posted 04-29-2008 1:17 PM by Derik Whittaker
Filed under:



Luke Foust wrote re: Nice side affect of Automatic Properties
on 04-29-2008 3:22 PM

I noticed this benefit too! The difficult thing is if you have a property that is not a primitive type, then you have to provide some sort of initialization for that object before it can be used. So then I end up having to convert the automatic property to being a "regular" property or add a constructor to my class. Do you have this pain?

Matt Hinze wrote re: Nice side affect of Automatic Properties
on 04-29-2008 3:29 PM

I use R# for this.. Alt-Enter, Implement members, Select All, Continue, Property generation -> Auto-property, Finish

Derik Whittaker wrote re: Nice side affect of Automatic Properties
on 04-29-2008 3:36 PM


Well, I just back with R#.  We broke up for a while.

Plus.  I could not remember that many key strokes if i tried.  Brain cannot handle more than 2 things at once. :)

JaredPar wrote re: Nice side affect of Automatic Properties
on 04-29-2008 4:41 PM

I agree this is goodness and I think it would also be nice if this was just the standard behavior for the VS smart tag "Implement Interface".  Instead it generates empty properties that throw.  Trivial to delete and add back the auto-property but it would be nice if it just did this already.  

jkay wrote re: Nice side affect of Automatic Properties
on 04-30-2008 2:51 AM

And by blogging about it, your'e back to square one ;-)

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)