The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Favorite C# 2.0 feature of the day: Anonymous Methods

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jeff Key

Posts: 481
Nickname: jeffreykey
Registered: Nov, 2003

Jeff Key is legally sane, but questionably competent.
Favorite C# 2.0 feature of the day: Anonymous Methods Posted: Jan 27, 2005 12:35 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Jeff Key.
Original Post: Favorite C# 2.0 feature of the day: Anonymous Methods
Feed Title: Jeff Key
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/jkey/Rss.aspx
Feed Description: Topics revolve around .NET and the Windows platform.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Jeff Key
Latest Posts From Jeff Key

Advertisement
I haven't done anything particularly interesting with anonymous methods yet, but the simple fact that they reduce clutter in Windows Forms makes me one happy camper. Consider the following bit of code, something which you've probably seen a thousand times:



And now, the same thing (effectively) using an anonymous method:



You can define all of your event handlers inline in a single method, if you choose, and forward any calls to appropriately named methods.

Read: Favorite C# 2.0 feature of the day: Anonymous Methods

Topic: What Bothers Me About Drug Research Previous Topic   Next Topic Topic: A machine that can learn a game

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use