I have a windows service, which contains a singleton which in turn uses some loggers, message queue listeners and so on. Those classes implements IDisposable
. S
No; Singleton shouldn't implement IDisposable
. What if someone disposes the instance prematurely when others are in need of that?
Also note that implementing IDisposable
will not help you when your service is crashed/stopped. You'll have to dispose it manually! but you can't find right time to do it.