Nick Sabalausky wrote:
"Daniel Keep" <[email protected]> wrote in message
news:[email protected]...
[snip]
What would be the point of making a special syntax when you can already do
that? :P
Same reason we have "while" and "foreach" in addition to "for".
How is this:
property int foo
{
get
{
return compute_value();
}
}
Appreciably better than this:
int foo()
{
return compute_value();
}
We have for and foreach because iteration is a *very* common use for a
loop, and you can screw it up when using while. In this case, having
property syntax for a computed field doesn't buy you anything whatsoever
apart from more typing.
Yes, property syntax can simplify some cases, but this isn't one of them.
-- Daniel
P.S. Please don't get my hopes up by quoting my entire post and then
only replying to one line; I thought I'd get to argue about my "80%" if
nothing else. :P