The quirky ?:
If there was ever a poll conducted for the most favorite C# operator, I’d guess the conditional operator ?:, also known as the ternary operator, will win hands down. I find it to be one of those tools that make things shorter and clearer at the same time. But how well do you know the operator? What do you think is wrong with the following piece of code? interface IDoer {} class ADoer : IDoer { } class BDoer : IDoer { } class Program { static void Main(string[] args) { bool flag = bool.Parse(args[0]); IDoer doer = flag … Continue reading The quirky ?: