When would I want to model a class with a private ctor?
- by dotnetdev
Hi,
I've seen plenty of classes in .NET which have private constructor (Stream is one of them I think). When would I want to model a class like this?
I keep thinking that if my class has no internal state/fields, then I can make it have a private constructor.
Am I on the right track with this idea? I can understand the use of a factory (I've run into the tipping point a few times), but not with a private constructor class.
Thanks