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