zoukankan      html  css  js  c++  java
  • C# while loop Running until user press key

    1. 
      
      static void CancelDemo()
              {
                  int i = 0;
                  //Console.WriteLine("Press ESC to stop");
      
                  //while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape))
                  //{
                  //    Console.WriteLine(++i);
                  //}
                  Console.WriteLine("Enput any key to stop console output!");
                  while(!Console.KeyAvailable)
                  {
                      Console.WriteLine(++i);
                  }
              }
      
      
      
      static void CancelDemo()
              {
                  int i = 0;
                  Console.WriteLine("Press ESC to stop");
      
                  while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape))
                  {
                      Console.WriteLine(++i);
                  }
              }
  • 相关阅读:
    对象排序
    MYSQL连不上
    JS读取.properties文件的方法
    Jquery简单使用
    JSP中request获取值
    MYSQL修改字段
    配置文件读取
    spring注解
    Route@简单应用
    MVC客户端验证的小示例
  • 原文地址:https://www.cnblogs.com/Fred1987/p/12100627.html
Copyright © 2011-2022 走看看