Examples from Chapter 9 (Delegates, Lambdas, and Events) of Programming C# 8.0 (O'Reilly).
- Example 2. Method with a delegate parameter
- Example 3. The Predicate<T> delegate type
- Example 4. Constructing a delegate
- Example 5. Implicit delegate construction
- Example 6. Delegates to methods in another class
- Example 7. Implicit instance delegate
- Example 8. Explicit instance delegate
- Example 9. CreateDelegate
- Example 10. Combining delegates
- Example 11. Invoking a delegate
- Example 12. Invoking each delegate individually
- Example 13. The first few Action delegates
- Example 14. The first few Func delegates
- Example 15. Delegate covariance
- Example 16. Illegal delegate conversion
- Example 17. A delegate referring to another delegate
- Example 18. A delegate explicitly referring to another delegate
- Example 19. New delegate for the current target
- Example 20. Converting a multicast delegate
- Example 21. The members of a delegate type
- Example 22. Using Invoke explicitly
- Example 23. Using Invoke with the null-conditional operator
- Example 24. Anonymous method syntax
- Example 25. Lambda syntax
- Example 26. Lambda variations
- Example 27. A zero-argument lambda
- Example 28. Ignoring arguments in an anonymous method
- Example 29. Using a variable from the containing method
- Example 30. Using a variable from the containing method
- Example 31. Where value comes from
- Example 32. Code generated for an anonymous function
- Example 33. Modifying a captured variable
- Example 34. Premature disposal
- Example 35. Problematic variable capture in a for loop
- Example 36. Modifying a loop to capture the current value
- Example 37. Capturing variables at different scopes
- Example 38. A lambda expression
- Example 39. What the compiler does with a lambda expression
- Example 40. Expressions and database queries
- Example 41. Use of lambda expressions by the Moq library