null check cant get out of this

guys ı cant get out of this .can you check and infor me about the place where ı should put null check . this for sharing the post for formality.ı didnt wanna determine the name age and salaray below. class _Employee { String? empName; int? empAge; int? empSalary; String get employeeName { return empName!; }… Read More null check cant get out of this

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

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 boardMap[i,j]… Read More What is the correct way to check for "possibly null" references?