C# - Using Console.
I need to implement delays between the writing of consecutive lines.
Other than nested for loops, is it anything easier much as a Timer for forms?
I want to control the duration of those delays.
Could anyone show a sample of code?
Gracias.

Ryan AlfordRank #1,411 · 1.2K reputationPosted Jan 1, 2009, 8:07 AM EST
Agustin Ferrari57 reputationPosted Jan 1, 2009, 2:08 PM EST
I managed to have a working snippet just by tweaking an example. But found no proper complete explanation on how to use it.
Could you elaborate a little? Events for forms are not in my area of interest.
Gracias.
Jan MontanoRank #1,295 · 1.3K reputationPosted Jan 1, 2009, 2:29 PM EST
Agustin Ferrari57 reputationPosted Jan 4, 2009, 2:12 AM EST
I am far from my PC so no chance to show that snippet for a while.
Could you explain how to use Timers.Timer and Threading.Timer to obtain a delay used once or for repetitive actions that I could stop or leave going forever?
Jan MontanoRank #1,295 · 1.3K reputationPosted Jan 5, 2009, 6:06 PM EST
Console.WriteLine("A");
Thread.Sleep(1000); // delay of 1000 milliseconds or 1 second.
Console.WriteLine("C");
for (int i=0; i<10; i++)
{
Console.WriteLine(stringarray[i]);
Thread.Sleep(10000); // delay of 10 seconds.
}
Thread.Sleep(0); // infiinte delay.
Agustin Ferrari57 reputationPosted Jan 10, 2009, 12:51 AM EST
Jan,
I managed to understand the basics of timers I could use with Console.
Gracias for that code.