0

we have a suite of applications for which I'd like to execute some standard code when the applications start in the Main() routine.

I was hoping I could do this via inheritance without having to put the same code in each occurrence of the Main() routine, but I'm unsure of the best way to do it.

Can anyone suggest how to go about this?

thanks

Matt

mattpm
  • 1,310
  • 2
  • 19
  • 26
  • Depends on what code you are trying to reuse. You could acheive reuse through a class structure or utilities. Share the code. – allen Feb 21 '13 at 06:14
  • Have you started by at least encapsulating that "standard start up code" into a reusable class? – Anthony Pegram Feb 21 '13 at 06:15
  • Yes thanks Anthony. I currently have a standard way of doing it which works ok. But I am a bit of a neat freak and hate duplicating the same code everywhere. It might be that this is the best I can hope for. Originally, I was inheriting from a form and had the code within the inherited form's load method. But because I'm also writing a number of apps which don't have a UI, I wanted to organise things such that the code is executed in the main() method. – mattpm Feb 28 '13 at 04:22

0 Answers0