null is not false

The way you typically represent a “missing” or “invalid” value in C# is to use the “null” value of the type. Every reference type has a “null” value; that is, the reference that does not actually refer to anything. And every “normal” value type has a corresponding “nullable” value type which has a null value….


Why not automatically infer constraints?

UPDATE: Whoops! I accidentally set a draft of this article to automatically publish on a day that I was away on vacation. The fact that it was (1) not purple and (2) introduced the topic and then stopped in mid-sentence were both clues that this was an unfinished edit. Sorry about that; I thought I…


Why are local variables definitely assigned in unreachable statements?

You’re probably all familiar with the feature of C# which disallows reading from a local variable before it has been “definitely assigned”: void M(){  int x;  if (Q())    x = 123;  if (R())    Console.WriteLine(x); // illegal!} This is illegal because there is a path through the code which, if taken, results in the local variable…