Reputation: 4377
I have several methods that are declared in the Main method.
Although how could I put a loop in, so in this case OutputChanges() would loop around to FileChanges(). And is it possible to put an break / interval of say 10 seconds inbetween the loop?
static void Main(string[] args)
{
FileChanges();
FolderChanges();
OutputChanges();
}
Upvotes: 0
Views: 4825
Reputation: 564333
I would recommend reworking this to use a Timer instead. The timer can tick every 10 seconds, at which time you can do your operations.
Upvotes: 1
Reputation: 540
static void Main(string[] args)
{
int counter=0;
do{
counter++;
FileChanges();
FolderChanges();
OutputChanges();
Thread.Sleep(10000);
}while(counter<10)
}
Upvotes: 1
Reputation: 53991
You could do:
static void Main(string[] args)
{
while(true)
{
FileChanges();
FolderChanges();
OutputChanges();
Thread.Sleep(10000);
}
}
Upvotes: 1
Reputation: 245399
You don't mention how many times you want to loop...so I'll go with the infinite loop (using Thread.Sleep()
to halt execution for 10 seconds between iterations):
static void Main(string[] args)
{
while(true)
{
FileChanges();
FolderChanges();
OutputChanges();
Thread.Sleep(10000);
}
}
Upvotes: 2
Reputation: 124632
static void Main(string[] args)
{
while( true )
{
FileChanges();
FolderChanges();
OutputChanges();
Thread.Sleep( 10000 );
}
}
Upvotes: 2