reflection - C# instantiate/initialize object at program startup -
I am currently a C / C ++ programmer working in C #, and I have to create some fancy initial accessories I am trying to move in some trouble.
I can come up with the best and easiest example that I want to create an "eager" singleton - which is created immediately on program startup, but without me, go to the main event of the program And "singleton.instance ()" is said to be the first thing. I read on static urgency, and it seems that a stable object has to be said or made before it starts, so I tried to create a stable variable that instantized the object, but it did not work.
Any hint?
Thank you!
EDIT: After some additional research, I think I can complete that I am using reflections with a single block code
< Div class = "post-text" itemprop = "text">
A static constructor is said only when you first look at the square that has a constructor. So when you want to run your initial code on program startup, you have to clearly specify the class that includes the constructor in your startup code (for example main method).
Comments
Post a Comment