Hi,
Is it common, in API Design, to do something like this:
public ReadOnlyCollection GetCollection
{
get { // Get's read only collection here...
}
}
In the body of the get, this calls a private method that fills the collection. So I only expose one, consistent object to clients. The thing which confuses me is if it is right to make the class and its members static? After all, we are returning an object so the class is immutable too (I keep thinking an immutable class should be static?). I am aware that static does not insinuate stateless. Am I right in thinking static is right for anything which will be centralised as one entity (e.g. company details)?
Thanks