首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

.NET3.5上用Lambda简化跨线程访问窗体控件,避免繁复的delegate,Invoke

2012-12-20 
.NET3.5下用Lambda简化跨线程访问窗体控件,避免繁复的delegate,Invoke1,错误的代码是:using Systemusing

.NET3.5下用Lambda简化跨线程访问窗体控件,避免繁复的delegate,Invoke

1,错误的代码是:

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication5{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        private string s = "http://www.chenjiliang.com/";        private void Form1_Load(object sender, EventArgs e)        {            new System.Threading.Thread(ShowTime).Start();        }        private void ShowTime()        {            this.SafeInvoke(() =>            {                textBox1.Text = DateTime.Now.ToString();            });        }    }}

?

热点排行