Date: 23.02.2019 14:45:52
Например, так:
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Diagnostics;
namespace ConsoleTest
{
class Program
{
static void DoSomething()
{
//...
}
public static void ExecuteWithDelay(Action deleg, int delay)
{
Stopwatch sw = new Stopwatch();
sw.Start();
deleg();
if (sw.ElapsedMilliseconds < delay)
{
Thread.Sleep(delay - (int)sw.ElapsedMilliseconds);
}
}
static void Main(string[] args)
{
ExecuteWithDelay(DoSomething, 300);
}
}
}
Автор: VadimTagil