Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for waitasecond.cs

(view source code of waitasecond.cs as plain text)

  1. using System;
  2. using System.Threading;
  3.  
  4. ///<summary>
  5. /// A time delay of 900..1100 milliseconds
  6. ///</summary>
  7.  
  8. namespace RobvanderWoude
  9. {
  10. 	class WaitASecond
  11. 	{
  12. 		static void Main( string[] args )
  13. 		{
  14. 			// Choose a random delay between 900 and 1100 milliseconds
  15. 			Random randomNums = new Random( );
  16. 			int delay = randomNums.Next( 900, 1100 );
  17. 			// Display the actual time delay if ANY command line parameter was passed
  18. 			if ( args.Length > 0 )
  19. 			{
  20. 				Console.WriteLine( "waiting {0} milliseconds . . .", delay );
  21. 			}
  22. 			// Now wait...
  23. 			Thread.Sleep( delay );
  24. 		}
  25. 	}
  26. }
  27.  

page last modified: 2024-04-16; loaded in 0.0058 seconds