C# 7 Series, Part 4: Discards

Sometimes we want to ignore values returned from a method, especially those out arguments, a typical example is to check whether a string can be parsed to another type: bool parsedValue;if (bool.TryParse(“TRUE”, out parsedValue)) { /* Do your stuff */ } Here we want to ignore parsedValue. We also want to make this variable inaccessible…

9

C# 7 Series, Part 3: Default Literals

C#’s default keyword has two kinds of usages: one is to label the fallback branch of the switch…case structure (for any path that does not fall into the case conditions); another is to represent the “default” value of a type. I will discuss this usage in this blog. The default value of a type is…

9