11 Replies
i tried setting the char choice = ' ', but i still get it and cannot find solutions online
Console.ReadLine() returns string?
But you are trying to parse with char
yh i do this in vs2022 and i get no warning, but when i had to switch to vscode it throws this
i normally do char.Parse and never get that warning in vs2022
oh you are talking about warning
ReadLine() returns string?
? indicates its nullable
You need to handle null situation or just tell the compiler dont worry about that with null forgive operator
! tells the compiler "I'm sure it's not null don't worry about it"
ahhh
never knew about that operator
thank you
I would generally advise you try not use the
!
operator unless you have no other choice
In this instance, you should check for nullyeah exactly
alr
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.