.html好 还是.asp好,各位说说在ASP.net里 用静态函数的好 还是实例函数出处HTML好???...
該樓層疑似違規(guī)已被系統(tǒng)折疊?隱藏此樓查看此樓
//在aspx的代碼段
public partial class _Default : System.Web.UI.Page
{
private ExamplefunctionClass m_new;
protected void Page_Load(object sender, EventArgs e)
{
//在 ExamplefunctionClass類里實現(xiàn)了HTML出處函數(shù)
// A段?? 用實例函數(shù)
m_new = new ExamplefunctionClass();
m_new.ShowHtml1("調(diào)用實例函數(shù) 1");
m_new.ShowHtml2("調(diào)用實例函數(shù) 2",123);
//.
m_new.ShowHtml12("調(diào)用實例函數(shù) 12");
m_new.ShowHtml1("調(diào)用實例函數(shù) 1");
m_new.ShowHtml2("調(diào)用實例函數(shù) 2", 123);
//.
m_new.ShowHtml12("調(diào)用實例函數(shù) 12");
// B段?? 用靜態(tài)函數(shù)
//在 StaticfunctionClass類里實現(xiàn)了HTML出處函數(shù)都是靜態(tài)函數(shù)
StaticfunctionClass.ShowHtml1("調(diào)用靜態(tài)函數(shù) 1");
StaticfunctionClass.ShowHtml2("調(diào)用實靜態(tài)函數(shù) 2", 123);
//.
//.
StaticfunctionClass.ShowHtml12("調(diào)用靜態(tài)函數(shù) 12");
StaticfunctionClass.ShowHtml1("調(diào)用靜態(tài)函數(shù) 1");
StaticfunctionClass.ShowHtml2("調(diào)用靜態(tài)函數(shù) 2", 123);
//.
//.
StaticfunctionClass.ShowHtml12("調(diào)用靜態(tài)函數(shù) 12");
}
//ExamplefunctionClass類里實現(xiàn)了HTML出處函數(shù)都是實例函數(shù)
//比如 實例函數(shù)?? ShowHtml1?? ShowHtml2?? ShowHtml3 ..............ShowHtml4
public?? void ShowHtml1(string text)
{
HttpContext.Current.Response.Write("
");
HttpContext.Current.Response.Write(text+"
");
HttpContext.Current.Response.Write("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
");
}
//StaticfunctionClass類里實現(xiàn)了HTML出處函數(shù)都是靜態(tài)函數(shù)
//比如 靜態(tài)函數(shù)?? ShowHtml1?? ShowHtml2?? ShowHtml3 ..............ShowHtml4
public static void ShowHtml1(string text)
{
HttpContext.Current.Response.Write("
");
HttpContext.Current.Response.Write(text+"
");
HttpContext.Current.Response.Write("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
");
}
}
用那個代碼段的(A段代碼 還是 B段代碼)性能最好 ??? 為什么??
總結(jié)
以上是生活随笔為你收集整理的.html好 还是.asp好,各位说说在ASP.net里 用静态函数的好 还是实例函数出处HTML好???...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python怎么学比较有技巧_学pyth
- 下一篇: 参数pyinstaller_Python