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主从复制搭建
    CSS基本样式简单介绍
    前端代码编码规范
    Markdown语法简单介绍
    Java API 操作Redis
    Java API 操作Zookeeper
    MySQL优化
    ES 可视化工具
    消息队列MQ
    Docker基础
  • 原文地址:https://www.cnblogs.com/Fred1987/p/12100627.html
Copyright © 2011-2022 走看看