Manoj S

Manoj S

  • NA
  • 56
  • 9k

Tell me how to make it less cumbersome?

Aug 23 2022 1:09 PM

Hi all. There is such a code. Tell me how to make it less cumbersome? Maybe add some refactoring?

Thread.Sleep is needed so that I can have time to enter the data necessary to run the methods.

static void Main()
{

        Console.Write("Enter the path for data invaiting: ");
        BackgroundTest shortTest = new BackgroundTest(Console.ReadLine());
        var task1 = Task.Run(() => shortTest.RunLoop());

        Thread.Sleep(100000);

        Console.Write("Enter the path for data invaiting: ");
        BackgroundTest longTest = new BackgroundTest(Console.ReadLine());
        var task2 = Task.Run(() => longTest.RunLoop());

        Thread.Sleep(100000);

        Console.Write("Enter the path for data invaiting: ");
        BackgroundTest veryLongTest = new BackgroundTest(Console.ReadLine());
        var task3 = Task.Run(() => veryLongTest.RunLoop());

        task1.Wait();
        task2.Wait();
        task3.Wait();
}

 


Answers (1)