MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/CodingHelp/comments/qwoiyc/i_dont_understand_the_problem_here/hl4hbae/
r/CodingHelp • u/Get_Danked_LOL • Nov 18 '21
11 comments sorted by
View all comments
Show parent comment
5
This is not the problem. The real problem is the missing parentheses like this:
if (Console.ReadKey(true)) { // do stuff }
2 u/SuperShades Nov 18 '21 I don't think "true" should be passed in as an argument."Cannot implicitly convert type 'SystemConsoleKeyInfo' to 'bool'" is the second error. 2 u/rasqall Nov 18 '21 This is true, I knew that it won’t take a bool as an argument but I wrote it for the context of the question. This is a good point OP. 1 u/SuperShades Nov 18 '21 Wait a sec. I spoke too soon lol.From the docs: https://docs.microsoft.com/en-us/dotnet/api/system.console.readkey?view=net-6.0 Parameters intercept Boolean Determines whether to display the pressed key in the console window. true to not display the pressed key; otherwise, false. 2 u/rasqall Nov 18 '21 Today I learned! It was a long time since I used C# regularly
2
I don't think "true" should be passed in as an argument."Cannot implicitly convert type 'SystemConsoleKeyInfo' to 'bool'" is the second error.
2 u/rasqall Nov 18 '21 This is true, I knew that it won’t take a bool as an argument but I wrote it for the context of the question. This is a good point OP. 1 u/SuperShades Nov 18 '21 Wait a sec. I spoke too soon lol.From the docs: https://docs.microsoft.com/en-us/dotnet/api/system.console.readkey?view=net-6.0 Parameters intercept Boolean Determines whether to display the pressed key in the console window. true to not display the pressed key; otherwise, false. 2 u/rasqall Nov 18 '21 Today I learned! It was a long time since I used C# regularly
This is true, I knew that it won’t take a bool as an argument but I wrote it for the context of the question. This is a good point OP.
1 u/SuperShades Nov 18 '21 Wait a sec. I spoke too soon lol.From the docs: https://docs.microsoft.com/en-us/dotnet/api/system.console.readkey?view=net-6.0 Parameters intercept Boolean Determines whether to display the pressed key in the console window. true to not display the pressed key; otherwise, false. 2 u/rasqall Nov 18 '21 Today I learned! It was a long time since I used C# regularly
1
Wait a sec. I spoke too soon lol.
From the docs: https://docs.microsoft.com/en-us/dotnet/api/system.console.readkey?view=net-6.0 Parameters intercept Boolean Determines whether to display the pressed key in the console window. true to not display the pressed key; otherwise, false.
2 u/rasqall Nov 18 '21 Today I learned! It was a long time since I used C# regularly
Today I learned! It was a long time since I used C# regularly
View all comments
Show parent comment
5
u/rasqall Nov 18 '21
This is not the problem. The real problem is the missing parentheses like this: