Warning: "Game" may be null here
I can't find a way to set this object as nullable.
I want the Game object to be a choice not a required one.
7 Replies
even if you set it as nullable this code will always throw an exception
Well you're not setting
Game
you need to provide a non-null default value for
Game
or add logic to conditionally create a Game
if they provide a game name etcYou're trying to set
Game.Name
while Game
while is unconditionally nullthe way your code is written now, it doesn't look like having a
Game
is optional because the constructor always tries to do something with itIn other words, you have a garage, the garage is empty, and you say "paint this car green"
Thank you guys so much. It works now! 😀 I think I've stared to long to the screen. Enough coding for me today.