Method Vs Property
Posted
by obsoleteattribute
on Stack Overflow
See other posts from Stack Overflow
or by obsoleteattribute
Published on 2010-06-15T02:28:00Z
Indexed on
2010/06/15
2:32 UTC
Read the original article
Hit count: 322
.NET
Hi,
I'm a newbie to .NET. I have a class called Project, a project can have multiple forecasts.Now If I want to check if the projects has any forecasts or not should I use a readonly boolean property called HasForecast() or should I use a method named HasForecast() which basically returns a boolean value.From framework design guidelines I came to know that methods should be used when the operation is complex,since here I'm retrieving the value of forecasts from DB should I consider method, or since it is a logical data member should I use a property.If I use a property can I call a method in DBLayer from its getter.Please explain
Regards, Ravi
© Stack Overflow or respective owner