The whole Idea is that I give the player 2 seconds to type Dodge or Attack. If they havent typed Dodge or Attack they die. I cant figure out how to break out of the ReadLine. I someone can help me thanks. (C# Console Application)
Asked
Active
Viewed 1,447 times
2
-
i'm not so familiar with C# but you can't just set an interval like; `Interval = 2000`; – Blazer Nov 03 '13 at 00:50
1 Answers
0
Note that reading from Console is no different that reading from a file, or another stream.
You will have to use threads.
Details here: How to add a Timeout to Console.ReadLine()?
EDIT: Make sure to have using System.Threading
if you use that answer.

Community
- 1
- 1

Paul Draper
- 78,542
- 46
- 206
- 285
-
1You're supposed to flag (or vote to close) as a duplicate, not post an answer linking to the duplicate. – user247702 Nov 03 '13 at 00:50
-
-
-
-
Does are errors: Error 1 The type or namespace name 'Thread' could not be found (are you missing a using directive or an assembly reference?) – Lars Nov 03 '13 at 00:56