C# 4.0 New Features: Optional and Named Parameters
Optional Parameters
- removes the ceremony of method overloads to assign default values
- static void GenerateChart(bool copyToWord = false)
-
Named Parameters
- call a method: GenerateChart(copyToWord: true);
Combining the two new features allow you to write concise code and not
specify values that are not needed in methods with a large number of arguments:
- Old: MethodA('A', null, null, null, false, null);
- New: MethodA(ArgA: 'A', ArgE: false);