Register   |  Login
You are hereHome
 Article Details
Anonymous method with and without parameter

One of the features added as part of language enhancements in dotnet 2.0 is anonymous method.

What is anonymous method?

A delegate with no named method associated with it is an anonymous method.

When do we use it?

When we do not want to have a separate method for a delegate

When we need to access the local variables

 

Example:

With Parameter:

int i = 0;

button1.Click += delegate(object s, RoutedEventArgs e)

            {

                i++;

                string buttonText = (s as Button).Content.ToString();

                MessageBox.Show(buttonText + " Clicked " + i.ToString() + " time(s)");

            };

Without Parameter:

int i = 0;

            button1.Click += delegate

            {

                i++;

                MessageBox.Show("I am clicked "+i.ToString() +" time(s)");

            };


Written By: Kumaravel
Date Posted: 2/10/2009
Number of Views: 949


Comments
1/2/2012 7:22:53 PM

Nike Air Max is a shoe by Nike that was introduced in 1987 as the first example of Air Max-branded technologies. Designed by Tinker Hatfield, the Nike Air Max shoe uses a large air cushioning unit which is visible at the side of the midsole in most models. Especially sought after models include the 1987 (Air Max I), 1990 (Air Max III), 1991 (Air 180), 1993, 1995, 1997, and to an extent, air max pas cher 2003.

In addition cheap handbags to lose hope. Help is surrounding the spot which there's help by using Hermes Duplicate clutches. For those who have placed your own cardiovascular system about the louis vuitton handbag Birkin you'll be able to still the item, definitely not taking into consideration a person's standard bank sense of cheap designer handbags balance.

6/7/2011 12:34:41 AM

ugg boots sale are believed to accept been aboriginal developed in Australia or New Zealand, although the exact date is uncertain-they accept been, at altered times, articular with pilots in World War I who are said to accept beat them for amore in unpressurized planes, shearers in rural Australia during the 1920s, surfers and aggressive swimmers who wore them in the 1960s and 1970s for befitting balmy while out of the water. In the aboriginal 2000s, uggs on sale they became a appearance trend in the United States, arch to added all-around sales.
ugg amberlee
ugg amelie sandals
ugg annabelle
ugg bailey button triplet
ugg evera
ugg highkoo
ugg kensington
ugg knightsbridge
ugg mayfaire
ugg raya
ugg retro Cargo

6/7/2011 12:34:22 AM

ugg boots sale are believed to accept been aboriginal developed in Australia or New Zealand, although the exact date is uncertain-they accept been, at altered times, articular with pilots in World War I who are said to accept beat them for amore in unpressurized planes, shearers in rural Australia during the 1920s, surfers and aggressive swimmers who wore them in the 1960s and 1970s for befitting balmy while out of the water. In the aboriginal 2000s, uggs on sale they became a appearance trend in the United States, arch to added all-around sales.
ugg amberlee
ugg amelie sandals
ugg annabelle
ugg bailey button triplet
ugg evera
ugg highkoo
ugg kensington
ugg knightsbridge
ugg mayfaire
ugg raya
ugg retro Cargo

lu juan Says:
4/5/2011 5:22:20 PM

My favorite part of the suite is Microsoft Office 2010 . You can use it like a fancy clipboard, but Office 2010 is much more powerful and useful.So, I'm forced to pay for an upgrade to Microsoft Office that I did not want.For the price, you can't go wrong with Outlook 2010 Home & Student. And, I may or may not be able to use the Product Key on the package I purchased to activate only Word, Excel, Microsoft outlook 2010PowerPoint and OneNote, the programs I thought I was buying. The only answer was to go to MS Office, or have everyone else in the world switch to Office 2007 .The instructions on the Microsoft website for activating Office imply that the full Microsoft Office 2007 Professional suite is the only version eligible for proper licensing.



You must be logged in to submit a comment.

Return