To aid with COM interoperability scenarios, C# 4.0 introduced optional and named parameters. Although we discuss those interoperability features in more detail when talking about dynamic programming, this is the right place to discuss optional and named parameters.
Methods can have overloads. Basically, that means that different method headers can exist that all share the same name but differ in the number of parameters or the type those parameters have. Often, we want to provide “convenience overloads” for methods that take a bunch of parameters, supplying default values for more advanced parameters.
A good example is the file-creation application programming interface (API) that exists in the
System.IO namespace. ...