Generic Abstract Singleton with Custom Constructor in C#

Posted by Heka on Stack Overflow See other posts from Stack Overflow or by Heka
Published on 2010-04-26T11:41:40Z Indexed on 2010/04/26 12:03 UTC
Read the original article Hit count: 234

I want to write a generic singleton with an external constructor. In other words the constructor can be modified. I have 2 designs in my mind but I don't know whether they are practical or not.

  • First one is to enforce derived class' constructor to be non-public but I do not know if there is a way of it?

  • Second one is to use a delegate and call it inside the constructor?

It isn't necessarily to be a constructor. The reason I chose custom constructor is doing some custom initializations.

Any suggestions would be appreciated :)

© Stack Overflow or respective owner

Related posts about c#

Related posts about design-patterns