Question

Is it a good practice to place helper methods within the MasterPage?

Should I be worried that when I introduce new classes in App_Code folder it can result more objects to be created in the memory and build and application start times will be increased as well?

thanks!

Was it helpful?

Solution

If your helper function is specific to the type of page that your MasterPage templates, then go ahead and put in in there. Otherwise, add it to the App_Code.

Don't worry about the memory required to put a function or a couple classes in the App_Code. It's not significant.

OTHER TIPS

I think it's better to put them into some special class (e.g. static one) if they are not related to the MasterPage otherwise some base class can be the solution. You can have more than one MasterPage...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top