create new instances or use public static methods?
Which one is the better way for a asp.net a开发者_如何学Gopplication in which i need to call methods from multiple pages? Or is there a third even better possibility?
Either works just fine. Another alternative is to build your own base class for pages, and put the common functionality there. With that approach, you can make the methods virtual and allow concrete classes to override functionality where appropriate.
You can also inherit all the pages from a common base page. But I would opt for the public static method if you do not need access to Page class members. Depends on what you actually want to achieve
精彩评论