This chapter focuses on events and callbacks in C#. They are important to understand since they give us more control over programs. An event is a message or notification from an object when either its property has been changed or a button has been clicked. A callback, also known as a delegate, holds a reference to a function. C# comes with Lambda expressions, which can be used to create delegates. These are also called anonymous methods.
We will also spend some time looking at a new operator, known as a Lambda operator. These are used in Lambda expressions. They were introduced in version 3.0 of C# so that developers could instantiate delegates. Lambda expressions replaced the anonymous methods that were introduced in C# 2.0 and are now widely used.
In this chapter, we will be covering the following topics:
- Understanding delegates...