I'm teaching myself c# and struggling to understand threading, async and the like. I'm trying to do some practical exercises to improve my knowledge.
I have two methods : method x and method Y
I need to create a task which will run method X and once method x is finished it will run method y.
I then want to build on this and create the same task three times. so essentially three different task which run the two methods.
The methods are public void
. I tried something like this:
Task[] tasks = new Task[2];
tasks[1] = Task.Run(() => x(n1.ToString()));
tasks[2] = tasks[1].ContinueWith(antecedent => y() ));