Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Guidelines

Author  Topic 

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2007-04-12 : 04:21:59
Does anyone have any guidelines on when to use a read only property and when to use a method? What is the difference between them? Is one early binding and the other late binding for example, or is it more complex than that? Are they actually the same thing?

How do I know when to use which?

thanks

steve

-----------

Don't worry head. The computer will do all the thinking from now on.

dfiala
Posting Yak Master

116 Posts

Posted - 2007-04-12 : 06:45:39
There is no binding difference. A property is just a special instance of a method.

If you need to pass parameters then you need to use a method.

If you are performing some action that is more than returning a value then probably want to use a method just so it is clear to yourself and other developers that some process will be triggered with the call.

In the long run using good names for your properties/methods is more important than deciding whether or not something calls for a method or read only property.

Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blogbaby
Microsoft MVP
Go to Top of Page

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2007-04-12 : 07:53:32
Thanks Dean that's very helpful

steve

-----------

Don't worry head. The computer will do all the thinking from now on.
Go to Top of Page
   

- Advertisement -