C#如何捕获键盘输入(新手提问)

bg8crv 2007-04-13 05:25:04
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace Example2_5
{
class Program
{
static void main(String[] args)
{
Console.WriteLine("Plaese Enter Number: ",myEnter);
myEnter = Console.ReadLine();
Console.WriteLine("you enter is: ",myEnter);
Console.ReadLine();
}
}
}

我想先输出一个
Please Enter Number:
然后用户输入:1
然后马上打出:your enter is:1

这段代码该怎么改一下呢?

标准的新手哈,请老鸟赐教!~
...全文
382 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
yitian130 2007-04-13
  • 打赏
  • 举报
回复
Console.ReadKey()
jf19840315 2007-04-13
  • 打赏
  • 举报
回复
using System;

namespace Example2_5
{
class Program
{
public static void Main(String[] args)
{
Console.WriteLine("Plaese Enter Number:");
string myEnter = Console.ReadLine();
Console.WriteLine("you enter is:{0}",myEnter);
Console.ReadLine();
}
}
}
yumanqing 2007-04-13
  • 打赏
  • 举报
回复
要在keyPress事件中处理就可以了哈

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧