5
Reply

Why we need Anonymous method?

Arunava Bhattacharjee

Arunava Bhattacharjee

Sep 24, 2014
3.8k
0

    for passing argument to the predicate type parameter , we nedd to implement the event handler with the same signature as the delegate. this will take sometime and complexity .so to reduce this anonymous method came. with the use of anonymous method you just specify the method implementation without method signature and return type ,the .net itself creates the eventhandler with the implementation specified in anonymous method. But Later lamda expression minimizes this also...

    Sathiswaran
    March 14, 2015
    1

    An anonymous method is a method without a name - which is why it is called anonymous. You don't declare anonymous methods like regular methods. Instead they get hooked up directly to events. You'll see a code example shortly.To see the benefit of anonymous methods, you need to look at how they improve your development experience over using delegates. Think about all of the moving pieces there are with using delegates: you declare the delegate, write a method with a signature defined by the delegate interface, declare the event based on that delegate, and then write code to hook the handler method up to the delegate. With all this work to do, no wonder programmers, who are new to C# delegates, have to do a double-take to understand how they work.Because you can hook an anonymous method up to an event directly, a couple of the steps of working with delegates can be removed. The next section shows you how this works.

    Ajay Gandhi
    November 20, 2015
    0

    Anonymous methods are unnamed methods used for creating delegates.

    Sreeni Dony
    July 22, 2015
    0

    http://www.tutorialspoint.com/csharp/csharp_anonymous_methods.htm

    Kml Surani
    April 15, 2015
    0

    http://www.tutorialspoint.com/csharp/csharp_anonymous_methods.htm

    Munesh Sharma
    October 01, 2014
    0