I have a sample piece of code with me:
bool _HasParsed;
object IsCheckedAsObj = GetCheckedStatus();
if (IsCheckedAsObj == null)
{
throw new InvalidOperationException("Status not found");
}
_HasParsed = (bool?)IsCheckedAsObj; //why (bool?) instead of (bool)
In the last line, I can understand that they are parsing the object to boolean. But what is that '?' doing there? Whats the difference between (bool?) instead of (bool)?