I can't recall how many times I've written code like:
void fillInTextBox(Control someControl, string value) { TextBox textBox = someControl as TextBox; if (textBox != null) { textBox.Text = value; } }
Starting with C# 7 pattern matching, we can combine this into one statement:
void fillInTextBox(Control someControl, string value) { if (someControl is TextBox textBox) { textBox.Text = value; } }
Now in one line. Much nicer!