To create a program that uses Task.Run
twice inside a Task.Run
in C#, you can use the following code:
main.cs821 chars35 lines
In this code, we're starting an outer task that will run some code, and inside that task, we're starting two inner tasks using Task.Run
. The inner tasks will execute in parallel to each other and to the outer task.
Note that the inner tasks are defined using lambda expressions to keep the code concise. Additionally, we're using Console.WriteLine
to output some text to the console to show when each task starts and completes.
gistlibby LogSnag