Defining Method Overloads

To define overloads for a method with a given name, you just define all the overloads as part of the same containing type. Where you put the method in the file (or files, in case partial classes are used) doesn’t matter, though keeping overloads of a method lexically together helps when browsing the code.

Note: A Word on Naming Conventions for Methods

Talking about method naming as the grouping key for a set of overloads, it’s good to say a word or two on the conventions in use for method names. Basically, they follow the so-called Pascal naming convention, where they start with an uppercase letter and each word starts with a capital too. For example, TryParse and WriteLine are conventional names, whereas tryParse

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.