471,108 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,108 software developers and data experts.

readonly property versus a function

Aside from a property being able to show up in the forms designer, is there
any reason - other than adhering to a particular coding convention for its
own sake - to use a readonly property instead of a function? I assume
they're equivalant in performance.

Paul
Nov 21 '05 #1
1 1074
"Paul" <no***@executespammers.org> schrieb:
Aside from a property being able to show up in the forms designer, is
there
any reason - other than adhering to a particular coding convention for
its
own sake - to use a readonly property instead of a function? I assume
they're equivalant in performance.

The reason is that they are used to implement different things. Properties
are used to implement an entity's (class) attributes while methods are used
to implement operations the entitiy can perform. In practice methods are
favored over properties if executing the property's 'Get' method takes a
long time, for example, when retrieving data from the internet or a
database, or when performing complex calculations.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jon Davis | last post: by
3 posts views Thread by Moe Sizlak | last post: by
5 posts views Thread by fred | last post: by
3 posts views Thread by Jon Davis | last post: by
12 posts views Thread by eric.goforth | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.