I am working on a .Net project(solution) which is having 25 projects. I want to set the value in some function/method so that It can be set once for the entire application. Where to set this method so that I dnt need to set it again in the individual winforms. That function/method is in some dll so i required to set that like this:
Logger obj = Logger.GetInstance();
obj.SetLogLevel(1);
I need to use the above code only once.
Kindly help?
Thank You…
Since you talk about pages, I assume you have a web site or a web application.
What you can do, in this case is to create a static class in App_Code and do this in it’s static constructor. This way the first time any page accesses the static class the code will run and it won’t run again.
EDIT:
In case this is a window application, just put this static class in one of the libraries. It doesn’t really matter where the class is.