I'm a C/C++ programmer recently working in C#, and i'm trying to do some fancy initialization stuff that I've run into some trouble with.
The best and easiest example i can come up with would be that I want to create an "Eager" Singleton - one that is created immediately at program startup, but without me requiring to go into the main function of the program and say "Singleton.Instance()" as the first thing. I read up on static instantiation, and it looks like it has to be called or created before a static object is instantiated, so I tried creating a static variable that instantiate the object, but that did not work. (I couldn't find any documentation on when static variables are instantiated/initialized).
Any pointers?
Thanks!
Edit: after some additional research, I think I can accomplish what I'm looking for with a single block of code utilizing reflection