Where to create singleton instance if I don't need this instance in my program?
Assume I have some singleton that just need to be instantiated. In constructor it starts timer, and updates some model data each second.
To execute singleton constructor I just need to reference it. I don't need resulting instance because I don't need to do anything with singleton it should exist during entire application execution.
However c# doesn't allow such construct: WcfLoader.Instance;
So I have to use this WcfLoader loader = WcfLoader.Instance; but i never use loader instance.
It looks odd, does it mean that I do something wrong?
Answers
Add a static Init method to your class, then call WcfLoader.Init instead of getting an instance. It won't look weird at all.