Overloading

Within the same struct, class, or interface, different methods with the same name can exist, as long as they differ in their signatures. The concept of a signature goes beyond just methods; instance constructors, indexers, and operators have them, too. For a method, a signature roughly corresponds to the method’s header, as illustrated earlier in Figure 10.1. One notable difference is the fact that a signature doesn’t include the return type as part of its formal definition. Although other differences exist that can be studied by specification lovers, this description suffices for our purposes.

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.