What is the correct way to check for "possibly null" references?

Advertisements I have this bit of relevant code: if (boardMap[i,j] != null) { Console.Write(boardMap[i,j].color.ToString() + " " + boardMap[i,j].type.ToString()); } else { Console.Write("X"); } boardMap contains potentially null values, which is why I implemented the if statement checking if the boardMap[i,j] item is null. However, I get a warning in line 2 telling me that… Read More What is the correct way to check for "possibly null" references?