Question: C# Visual studio Create a console application with two methods and a Main method.Method 1 Static void doSomething(int taskId, int sleepTime) Display the taskId has
C# Visual studio
Create a console application with two methods and a Main method.Method 1
Static void doSomething(int taskId, int sleepTime)
Display the taskId has started, sleepTime = sleepTime.
Sleep is part of the thread class and which waits the number of milliseconds before continuing execution. Sleep the number of milliseconds passed in the sleepTime argument.
Display taskId has finished.
Method 2
Static void doSomethingElse(int taskId, int sleepTime)
Display the taskId has started something else, sleepTime = sleepTime.
Sleep is part of the thread class and which waits the number of milliseconds before continuing execution. Sleep the number of milliseconds passed in the sleepTime argument.
Display taskId has finished something else.
Main methodCreate task t1 which calls doSomething(1, 1200)
Continue task t1 calling doSomethingElse(1,500)
Start task t1
Create task t2 which calls doSomething(2, 6000)
Start task t2
Create task t3 which calls doSomething(3, 3000)
Start task t3
Wait for all tasks to be completed then display Hit any key to exit.
Use Console.ReadKey() to detect when a key has been pressed.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
