虽然4.0有了新特性。

Named And Optional Arguments - 命名参数和可选参数

public partialclass NamedAndOptionalArguments : System.Web.UI.Page
    {
       
protectedvoid Page_Load(object sender, EventArgs e)
        {
            Write(
"hello");
            Write(
"hello","webabcd");
            Write(
"hello", p3:false, p2:"webabcd");
        }

       
privatevoid Write(string p1,string p2 = "p2",bool p3= true)
        {
            Response.Write(
string.Format("p1:{0}; p2:{1}; p3:{2}", p1, p2, p3.ToString()));
            Response.Write(
"<br />");
        }
    }

相关文章:

  • 2021-09-08
  • 2021-10-05
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
猜你喜欢
  • 2021-07-06
  • 2021-10-14
  • 2021-11-23
  • 2022-01-10
  • 2022-12-23
相关资源
相似解决方案