Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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()
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top