Monday, February 14, 2005

Public fields in C# outlawed by FxCop

There is a rule in FxCop that screams if there's a public field in a class. It says, convert it into a property, because properties work as fast as fields. This may well be true, but it's not an argument in favor of properties. How's this: it's much faster to create a field; and changing a field into a property is absolutely painless in C#? I thought this was the point of C# get and set accessor methods in the first place.

No comments: