Console Input Capture in Class Library

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello world

I have a console application that loads several classes. I would like on of my classes to be able to detect input made in the console and take action based on the input. Sounds simple but of course in my class library I can't see the Console object. Anybody know how to do this

Thanks

Derek
 
Sounds simple but of course in my class library I can't see the Console
object.

Why not? Should be able to just call Console.Read or ReadLine as normal.
Are you getting some error?
 
That is the weirdest part. I don't get an error. In the IDE the
debugger just skips to the end of the function when I call
Console.ReaLine

string line = System.Console.ReadLine(); Exits here
char[] input = line.ToCharArray(); this never executes

No error message thrown. Basically I want to capture input so I can
shut down or pause the app if the user inputs certain characters.
 
Back
Top