What does the following code do?
class MyClass {
private int[] myPrivates;
public int[] GetMyPrivates
{
get { return myPrivates; }
}
protected int[] SetMyPrivates
{
set { myPrivates = value; }
}
}
Is there a better way of protecting the array myPrivates? Is it possible to make it reat-only?
You could replace your getters and setters with a property this way:
You can add pretty much any protection level that is less that the one of the property to getters and setters.