5
Reply

Why we need Anonymous method?

    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...

    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.

    Anonymous methods are unnamed methods used for creating delegates.

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

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