Use of Anonymous methods and Lamda Expression.

In the following code snippets I am trying to get the Odd numbers from the integer array.
In the first method I have used Anonymous Methods approach and in the second one I have used Lamda Expression.
Proceed with the same, I just want to give you all a short introduction about both the things.In general we can say that Anonymous methods are inplace of delegate.In the simple approach of methods calling ( as mention in the attachement) one need to provide the delegate object to the method call.But Anonymous methods allow us to write inline code instead where previously delegate need to be passed.
Where as in Lamda Expressions are just one or more parameters with an statement or Expression followed by it. Lamda operator ( => ) is used between the parameters and the expression.
Below are the examples showing the use of above two approaches of calling methods.



No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: