I have a somewhat opposite view of properties than you Paolo. Why such a resistance to using them? I encouraged developers to add properties whenever exposing data from one class to another. Some programming languages require that you do this. To me it is more consistent than using Public attributes in some cases and properties in others. One of the reasons I discourage making attributes public is because it is too easy for programmers to just decide to quickly change an attribute to public to solve an issue on the fly.
Sorry Ajaxx,
I didn't make myself clear enough. (You'll have to excuse me it was very late at night after a long day fighting SAX Basic). I'm not against Properties. They are great! The point I was trying (unsuccessfully) to make was:
IF (and it's probably a big if) ALL you are doing is a simple set and get of a private variable, then just create a Public variable - but whose adornment is that of a Property.
I've only recently started programming in C#. Two Weeks ago I would have "laid out" a simple Property as:
private bool mbEATypeIsElement;
public bool EATypeIsElement
{
get
{
return mbEATypeIsElement;
}
set
{
mbEATypeIsElement = value;
}
}//propertyTwo days ago, I started doing:
private bool mbEATypeIsElement;
public bool EATypeIsElement { get { return EATypeIsElement; } set { mbEATypeIsElement = value; } Now, it's a bit more obvious that mbEATypeIsElement is adding no value.
So yesterday I decided...
public bool EATypeIsElement;Now as it turns out, in .NET there are useful consequences of this. The C# compiler can do certain optimisations which is can't do if EATypeIsElement is a real property.
So, in summary, I'm certainly not against Properties. I'm just saying that there's not much point in having two things do the job of one, in the simple case.
However, if you make the variable
LOOK like a property, then you can replace the variable with a property later, and the rest of your code doesn't know the difference

Paolo