I really want to put in some sort of section handler into App.config that will execute some code before the application actually starts executing at Main. Is there any way to do such a thing?
Asked
Active
Viewed 386 times
1
-
Are you trying to dynamically run code that you've placed in the app.config file on startup? – MusiGenesis Oct 10 '08 at 22:15
2 Answers
2
Not sure what you're trying to accomplish...but, I'm not aware of anyway you can have a console application run any other method before Main(). Why not do something like this:
static void Main(string[] args)
{
//read your app.config variable
callAlternate = GetConfigSettings();
if(callAlternate)
AltMain();
///...rest of Main()
}

Ricardo Villamil
- 5,031
- 2
- 30
- 26
1
Why dont you put that call as the first instruction in your main function?
Otherwise you can define another entry point for your program and call your main from there but its basicaly the same

Eric
- 19,525
- 19
- 84
- 147