Method Groups

Closely related to method overloads are method groups, which are typically used with delegates, as you will see later in Chapter 17, “Delegates.” Basically, a method group is a set of overloaded methods that’s classified as an expression and is created by using a member lookup operation. For example, the following are method groups:

Console.WriteLinename.Substring

In a nutshell, delegates are a means to refer to a method such that it can be passed along as an object. For example, one piece of code might need “a method that will be able to take an object and return a Boolean to indicate whether it passes a condition.” To express this, it can take in a delegate that basically captures the signature of such a helper method it needs ...

Get C# 5.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.