public partial class HelloWorldService : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//HttpHelloWorldService.GetInstance().Execute(Request, Response);
//--can the above code be written in the following 3 lines??.......
HttpHelloWorldService.GetInstance();
HttpHelloWorldService hhtt = new HttpHelloWorldService();
hhtt.Execute(Request,Response);
}
}
注: - HttpHelloWorldService
是一个静态类,2种方法为如下:这可以替代单身模式吗?如果不是原因?
- public static HttpHelloWorldService GetInstance()
- public void Execute(HttpRequest request, HttpResponse response)
是它可能..... –