Brahim Benbachir

Look and See#
posts - 2, comments - 2, trackbacks - 1

My Links

News

Archives

Post Categories

News

SQL Server 2005

.NET

A case where it's usefull to use anonymous methods feature of C# 2.0
In C# 1.0, when you wanted to start a thread, you were obliged to write code like this: private void button1_Click(object sender, EventArgs e){ Thread t = new Thread(new ThreadStart(Method)); t.Start();} void Method(){ MessageBox.Show("Thread has started");} In C# 2.0, you can use the new feature that are anonymous methods private void button1_Click(object sender, EventArgs e){ Thread t2 = new Thread(delegate() { MessageBox.Show("Thread has started"); }); t2.Start();}Anonymous methods are usefull...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Friday, September 29, 2006 10:44 AM | Feedback (0) | Filed Under [ .NET ]

Powered by: