In .NET 3.5, I’d like to create a singleton interface:
interface ISingleton <T> { public static T Instance {get;} }
Of course that doesn’t work but is what I’d like. Any suggestions?
EDIT: I just want it to be known that all singeltons will have a static property named Instance of the class type. It is always there. An interface would be an explicit way to express this.
An Interface can’t, to my knowledge, be a Singleton since it doesn’t actually exist. An Interface is a Contract that an implementation must follow. As such, the implementation can be a singleton, but the Interface can not.