mo.notono.us

Friday, April 30, 2004

Jay and Properties...

Eric Gunnerson and a host of others debate the virtue of properties in C#: Jay and Properties... Here's my take on the properties implementation in C#: I generally would agree with Ryan about assumed private members being a bad thing. But I also like what I think Thomas is hinting at - what if a simple
public property string Name;
was equivalent to something like
private string ___name;
public string Name
{
  get { return ___name; }
  set { ___name = value; }
}
BUT if you declared Name using get & set, nothing would be automagically linked up? Of course is there really any difference between that and a public field? (original post that spawned the debate: jaybaz_MS's Weblog: Properties? Not my bag, baby. In general I have to say I agree with Jay, and am thinking I'll be using fewer "simple properties" from now on...)

0 Comments:

Post a Comment

<< Home