0

Error: cannot convert from system.thread.tasks.task to system.action

Task A = Task.Run(() => Filecopy.COPY_F(txtpatterns.Lines, txtsourcepath.Text));

Task B = Task.Run(() => Unzip.Data(Filecopy.zipfilepath));

Task C = Task.Run(() => GIO_LOad.Data(Unzip.GIOlist));


Task t = null;
t = Task.Factory.StartNew(() => A
                             .ContinueWith(B)
                             .ContinueWith(C),
                             TaskScheduler.FromCurrentSynchronizationContext()));

I'm trying to run these tasks one by one, because task B will get List<string> from task A and task c will get listof string from task B.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
peter s
  • 9
  • 5
  • 3
    Why even bother with threads if you want them to run sequentially? – Daxtron2 May 09 '18 at 12:35
  • `async/await` means you don't need ContinueWith at all – Panagiotis Kanavos May 09 '18 at 12:59
  • @TJWolschon Looks like the intent is to run the first two in a non-UI thread, and the last in a UI thread (although it doesn't succeed in that endeavor). In that case, there's no need to break up the first two into separate continuations, but the use of tasks and continuations in general would be sensible. – Servy May 09 '18 at 13:00

0 Answers0