Fields are really not properties.
They look similar, but under the hood a field is a piece of data and a property is really a collection of functions.
public class Thing
{
public int x;
}
really is exactly what it says on the tin, but
public class Thing
{
public int X {get;set;}
}
is more like
public class Thing
{
private int _x;
public int get_X() { return _x; }
public void set_X(int value) { _x = value; }
}
in fact, if you fire up Reflector*, that's exactly what you'll see.
.property instance int X
{
.get instance int MyNamespace.Thing::get_X()
.set instance void MyNamespace.Thing::set_X(int)
}
*you do have reflector, right? I mean, you'd be insane to do .net development without it.
if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight