When defining classes I expose class members as properties along the lines of :
class ClassA
{
private String _Name;
public String Name
{
get { return _Name; }
set { _Name = value; }
}
}
What is best practice for dealing with collections within classes, with respect to accessors
So if the class is extended to something like :
class ClassA
{
private String _Name;
private List<String> _Parts = new List<String>();
public String Name
{
get { return _Name; }
set { _Name = value; }
}
}
How do I expose the next item?
Expose a read-only instance of the collection. Note that the contents are not read-only, but the reference is.