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();
}
相關文章
c#使用Dataset讀取XML文件動態(tài)生成菜單的方法
這篇文章主要介紹了c#使用Dataset讀取XML文件動態(tài)生成菜單的方法,涉及C#使用Dataset操作XML文件的相關技巧,需要的朋友可以參考下2015-05-05c# WPF中自定義加載時實現(xiàn)帶動畫效果的Form和FormItem
這篇文章主要介紹了c# WPF中自定義加載時實現(xiàn)帶動畫效果的Form和FormItem,幫助大家更好的理解和學習使用c#,感興趣的朋友可以了解下2021-03-03