Arunava Bhattacharjee
Why we need Anonymous method?
By Arunava Bhattacharjee in C# on Sep 24 2014
  • Sathiswaran
    Mar, 2015 14

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

    • 1
  • Ajay Gandhi
    Nov, 2015 20

    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.

    • 0
  • Sreeni Dony
    Jul, 2015 22

    Anonymous methods are unnamed methods used for creating delegates.

    • 0
  • Kml Surani
    Apr, 2015 15

    • 0
  • Munesh Sharma
    Oct, 2014 1

    • 0

Most Popular Job Functions