using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Tuple<dynamic, string, int> Mytuple = GetTuple(); //Mytyple.[Item1|2|3]获取相应值
dynamic Mydyn = Mytuple.Item1;
Response.Write("方法1:" + Mydyn.GetType() + "<br/>");//运行时确定类型 System.Double
Response.Write("方法2:" + TestFuncion() + "<br/>");
Response.Write("方法3:" + TestFuncion(i: 998) + "<br/>");
Response.Write("方法4:" + TestFuncion(s: "这个是参数2") + "<br/>");
Response.Write("方法5:" + TestFuncion(23, "方法5"));
}
protected Tuple<dynamic, string, int> GetTuple()
{
return new Tuple<dynamic,string,int>(98.012,"参数1为double类型",80);
}
protected string TestFuncion(int i = 100, string s = "参数1")
{
return "Int i =" + i + " String s=" + s;
}
}
}