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.


Need Your Help

Forcing text entry on textbox to be am/pm

c# regex wpf

I'd like to create a textbox that forces the user to enter either "am" or "pm" or if they don't finish and move to another control having only entered an "a" or "p" automatically finish it off. Or ...

Make flash-movie full browser size?

actionscript-3 actionscript

I'm trying to create a small flash-app, which needs to run as big as possible on the browser. For example regexr and Grooveshark work this way. However, if I use the File -> Publish Settings and...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.