手机
当前位置:查字典教程网 >编程开发 >C#教程 >c# 匿名方法的小例子
c# 匿名方法的小例子
摘要:复制代码代码如下://Createahandlerforaclickevent.button1.Click+=delegate(System...

复制代码 代码如下:

// 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# 匿名方法的小例子】相关文章:

C# 合并GriewView相同列的小例子

C# DES加密算法中向量的作用详细解析

c# datetime方法应用介绍

c# 调用.bat文件的实现代码

c#固定长度的随机字符串例子

c#使用linq技术创建xml文件的小例子

.NET程序页面中,操作并输入cmd命令的小例子

C#中常使用进度条的代码

C# 禁止应用程序多次启动的实例

c# winform读取xml文件创建菜单的代码

精品推荐
分类导航