[RESOLVED] Why use Properties?
Hi,
I was just thinking for a reason (good, sound reason), why do we need to implement Properties, or any kind of 'Get'ers and 'Set'ers.
Just because it conforms to OOP way of programming is something not reasonable (at least to me). Suppose if the same question is put to you while you are being interviewed, what do you guys suppose could answer the question in succinct manner?
How does it help? How does it help in future development? When we say it is secure, how is it secure? If it is efficient, how so?
Hope I am being clear.
Thank you
Re: [RESOLVED] Why use Properties?
Here's a few reasons:
http://blogs.msdn.com/b/vbteam/archi...han-aneja.aspx
There are even more, such as being able to call events in the setter and the fact that properties show up in the designer where fields do not.
I linked to this webpage at least 3 times already :p
Re: [RESOLVED] Why use Properties?
Want to know something funny, if you look at the IL emitted from your application you will see that the property you make is actually just a set of get()/set() functions when it boils down to it.
Having said that, they are wired into the framework so don't go using get/set methods instead of properties.