public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public delegate void showMessage(string msg);
public static void showM(string m)
{
MessageBox.Show(m);
}
public string returnM(string m)
{
return m;
}
private void button1_Click(object sender, EventArgs e)
{
//3
showMessage s = new showMessage(showM);
s("xxx");
//1
Action
action("123");
//2
Action
a("aaaaaaaaaa");
//6
Action
{
MessageBox.Show(x1);
};
ac("111111111111111");
//6
Action
MessageBox.Show(xx);
};
ac2("222222222222");
//5
string m1 = "123";
textBox1.Invoke((Action
{
textBox1.Text = m;
},m1);
textBox1.Invoke(new Action
{
textBox1.Text = x4;
}), "aaaaax4");
//4 --需要return
Func
MessageBox.Show(f("abc"));
//7
Func
{
return "我是Func
};
MessageBox.Show(func());
//8
Func
{
return s3;
};
MessageBox.Show(funcOne("我是Func
//9
Func
{
return value1 + " " + value2;
};
MessageBox.Show(funcTwo("xxx", "我是Func
//10
Func
{
return x1 + " " + x2;
};
MessageBox.Show(funcTwo("xxx", "我是Func
}
{
if (dt == null || dt.Rows.Count == 0)
{
return null;
}
IList
foreach (DataRow dr in dt.Rows)
{
list.Add(func(dr));
}
return list;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = newstable();
IList
{
Model m = new Model();
m.f_id =Convert.ToInt32(row["f_id"]);
return m;
});
}
}
static void Main(string[] args)
{
IList
list.Add("1");
list.Add("2");
list.Add("3");
list.Add("4");
list.Add("5");
Func
IList
}
static IList
{
return list.Where(exp).ToList();
}
}