using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { // 非同期で1文字読み取るタスク Func readAsync = () => Console.ReadKey(true); var task = Task.Factory.StartNew(readAsync); while (true) { if (task.IsCompleted) { Console.WriteLine(task.Result.KeyChar + "が押されました"); if (task.Result.KeyChar == 'D') { //ここでは文字列を得たい string input = Console.ReadLine(); Console.WriteLine(input + "が入力されました"); if (input == "sss") { //sssが入力された時、処理を行う break; } } task = Task.Factory.StartNew(readAsync); } } } } }