c# 匿名方法的小例子
// Create a handler for a click event.
button1.Click += delegate(System.Object o, System.EventArgs e)
{ System.Windows.Forms.MessageBox.Show("Click!"); };
// Create a delegate.
delegate void Del(int x);
// Instantiate the delegate using an anonymous method.
Del d = delegate(int k) { /* ... */ };
void StartThread()
{
System.Threading.Thread t1 = new System.Threading.Thread
(delegate()
{
System.Console.Write("Hello, ");
System.Console.WriteLine("World!");
});
t1.Start();
}
相关文章
深入多线程之:用Wait与Pulse模拟一些同步构造的应用详解
本篇文章是对用Wait与Pulse模拟一些同步构造的应用进行了详细的分析介绍,需要的朋友参考下2013-05-05


最新评论