lambdas and type inferrence are underrated. Lambdas can have multiple statements and theydouble as a compatible delegate object automatically (just make sure the signature match) as in:
Note that I don't have a
new CancellationEventHandler nor do I have to specify types of sender and e , they're inferable from the event. Which is why this is less cumbersome to writing the whole delegate (blah blah) which also requires you to specify types of parameters.
Lambdas don't need to return anything and type inference is extremely powerful in context like this.
And BTW, you can always return Lambdas that make Lambdas in the functional programming sense. For example, here's a lambda that makes a lambda that handles a Button.Click event:
Note the chaining:
(dx, dy) => (sender, e) =>
Now that's why I'm happy to have taken the functional programming class :-)
Other than the pointers in C, I think it's the other fundamental thing you should learn :-)
|
All Types GNIIT/NIIT Solution (Mr Jerry) Follow me on G+ and Twitter for more updates Twitter @mrjerry0001 #Write for us and get paid contact us On hike App:- @mrjerry4968
Pages
▼
Recommended Downloads
▼
No comments:
Post a Comment