Christian Nagel's OneNotes

.NET Training, Consulting, Coaching - C#, Web Services, Enterprise Services, ASP.NET, Whidbey, Longhorn and More!

Sponsors

Affiliations

Books I've written

INETA UG Leaders

My Blogroll

Properties and Fields

Martin Fowler blogs about that he liked the notion of properties from the beginning (compared to Java's getX/setX).

However, he doesn't like that fields and properties are handled differently by reflection, so it is not possible to change a field to a property afterwards. Now he has to write "stupid accessor functions for accessible data values".

I think this is just an issue on how much work it is to write properties. Using Whidbey, this is a fast & simple task. For VS.NET 2003 Frans Bouma has written a Macro to create properties.

Christian

Comments

Dennis v/d Stelt said:

Hahahaha, I think it's Frans Bouma.
Did you do the mistake on purpose? ;)
# February 5, 2004 6:41 AM

Christian said:

Thanks Dennis! No, I didn't do the mistake on purpose. Already corrected.
# February 5, 2004 7:10 AM

Scott said:

For VS.NET 2002/2003 I am a big fan of QuickCode.NET: http://www.dvxp.com/en/Downloads.aspx

-Scott
# February 5, 2004 10:00 AM

vnrg said:

i don't think it's only a problem of generating an access code. the problem is that this code is relatively unnecesarry.
# February 5, 2004 10:32 AM

Christian said:

vnrg, I don't agree with you that this code is unnecessary. Do you prefer public fields or get/set methods instead of properties?
I prefer properties.
# February 6, 2004 5:12 AM

vnrg said:

so what properties really are? aren't they just functions?
what is the purpose of declaring public field in the class?
isn't all this just an implementation detail?
maybe i am going too far and trying to argue about fundamentals of ".net core". maybe JITting could solve this for us. maybe IL could be more abstract. maybe not ;)


and of course i'm using properties. but that was the point: "why?"
# February 6, 2004 10:25 AM

Christian said:

Of course, properties are just functions. However, the caller uses properties similar to fields - I prefer this in contrast to the setX(), getX() style with Java.
I don't see your relation with public fields. What's your point with that regarding properties? Sometimes it is OK to use public fields, e.g in the automatically generated classes from the wsdl.exe utility.
# February 6, 2004 11:37 AM

TrackBack said:

# December 17, 2004 3:52 AM

TrackBack said:

# December 17, 2004 4:42 AM

ipad app office said:

Good is good, but better carries it.

-----------------------------------

# December 22, 2010 2:17 AM

best ipad stand said:

-----------------------------------------------------------

Such a usefule blog…really

# January 11, 2011 6:57 PM

cordless phones reviews said:

"I don't know about you fellows but for me the layout of a blog is incredibly important, almost as a lot as the write-up itself.  Furthermore I'm a actual mug for online video  clips... or, as a matter of truth, ANY media articles whatsoever."

--------------------------------------------------------------------  

I have a <a href="ericsreviews.com/">nikon camera reviews</a> Website,i love him.Mania !You are welcome to look!

# January 16, 2011 7:21 PM

allnakedcelebritiesi said:

kam naložiti denar <a href=http://www.vzajemniskladi.info>krekovi skladi</a>

# February 18, 2012 10:24 PM

beachnakedg said:

avtonet <a href=http://www.varcevanje.info>pokojninsko varcevanje</a>

# February 18, 2012 10:24 PM

chenowethm said:

Paparazzi Oops  <a href=cartarticles.info/.../a>

# June 11, 2012 10:00 AM

AnollaOrirl said:

<a href=http://www.achattdoudounesmagasinn.info>doudoune moncler</a>

Properties and Fields - Christian Nagel's OneNotes

# October 30, 2012 12:17 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)