Wednesday, May 14, 2008

Everything you (or I) know (about C#) is wrong

I used to labor under the impression that public fields and properties in C# were completely interchangable. My approach when implementing a class in C# was to start with a public field and only make it a property later if and when I actually needed to do something interesting with the getter or setter.

Well, Kristof Verbiest has disabused me of that erroneous opinion. It looks like starting with properties with default getters and setters is the way to go.