C#隨機(jī)設(shè)置900-1100毫秒延遲的方法
更新時間:2015年04月16日 11:14:36 作者:work24
這篇文章主要介紹了C#隨機(jī)設(shè)置900-1100毫秒延遲的方法,涉及C#中Thread.Sleep方法的使用技巧,需要的朋友可以參考下
本文實(shí)例講述了C#隨機(jī)設(shè)置900-1100毫秒延遲的方法。分享給大家供大家參考。具體如下:
using System; using System.Threading; ///<summary> /// A time delay of 900..1100 milliseconds ///</summary> namespace RobvanderWoude { class WaitASecond { static void Main( string[] args ) { // Choose a random delay between 900 //and 1100 milliseconds Random randomNums = new Random( ); int delay = randomNums.Next( 900, 1100 ); // Display the actual time delay //if ANY command line parameter was passed if ( args.Length > 0 ) { Console.WriteLine("waiting {0} milliseconds...",delay); } // Now wait... Thread.Sleep( delay ); } } }
希望本文所述對大家的C#程序設(shè)計有所幫助。
相關(guān)文章
100行C#代碼實(shí)現(xiàn)經(jīng)典掃雷游戲
這篇文章主要為大家詳細(xì)介紹了如何用100行C#代碼實(shí)現(xiàn)經(jīng)典的掃雷游戲,文中的示例代碼講解詳細(xì),具有一定的借鑒價值,需要的可以參考一下2023-02-02在.net應(yīng)用程序中運(yùn)行其它EXE文件的方法
這篇文章主要介紹了在.net應(yīng)用程序中運(yùn)行其它EXE文件的方法,涉及C#進(jìn)程操作的相關(guān)技巧,需要的朋友可以參考下2015-05-05超簡單C#獲取帶漢字的字符串真實(shí)長度(單個英文長度為1,單個中文長度為2)
正常情況下,我們是直接去string的length的,但是漢字是有兩個字節(jié)的,所以直接用length是錯的2018-03-03WinForm使用DataGridView實(shí)現(xiàn)類似Excel表格的查找替換功能
這篇文章主要介紹了WinForm使用DataGridView實(shí)現(xiàn)類似Excel表格的查找替換功能,現(xiàn)在小編通過本文給大家分享查找替換實(shí)現(xiàn)過程,需要的朋友可以參考下2021-07-07