Re: C# 3.0 partial methods and automatic properties
Fabian Schmied <[email protected]> Fri, 10 Nov 2006 20:31:23 +0100
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <[email protected]> |
[Adam] > Can't answer the first one, but the second one is an easy answer: usability. Yes, of course you're right, automatic properties are definitely better than manually typing trivial properties. Hoewever, my question really was about opinions on why you need trivial properties instead of public fields. (And why one would want it so badly to introduce a new language feature for that.) Marc's point is actually quite valid: [Marc] > The OTHER thing this gains you is that much of the DataBinding code > (and such) all over the framework will only allow you to bind to > properties, not fields. I hadn't thought of that. Still, it's actually the DataBinding code that is to blame there; it could work with public fields - after all, they are completely valid ways of making data available to the outside. The problem is that currently there are really two ways of achieving (more or less) the same high-level behavior - trivial properties and public fields. Maybe Marc is right and one should have disallowed public fields from the beginning; then at least everyone would consistently use trivial properties for that purpose. Fabian =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com