I’m all for shortening the amount of code we write, if it makes it more readable. One enhancement I make use of in C# is the ternary conditional operator. Consider the following block of code: string input = "hi"; bool saidHello; if (input = "hello") { saidHello = true; } else { saidHello = false; } In this example, we can see, the saidHello boolean value would be false, as the input string...
C# Ternary conditional operator – Question mark in an if statement
C