New language features in C# 4.0
Language releases tend to add features that remove small daily annoyances. The C# 4.0 era added several worth knowing.
Named and optional arguments
You can skip an argument that has a default and name the ones you do pass, which makes a call with many parameters readable.
public void Send(string to, string subject = "Hello",
bool urgent = false) { }
Send("[email protected]", urgent: true);Dynamic typing
A dynamic variable defers type checking until the program runs, which is useful when talking to a system that does not describe itself in advance. It trades compile time safety for flexibility, so use it sparingly.
These features build on the fundamentals in building your own types, so learn those first if you have not already.