0

I have a scenario where I need to ensure the following :

  1. UI, on button click makes a GET call to an API and waits for a response.
  2. API method has to perform two tasks X and Y on the GET request, but it should return X's response as soon as it gets it and performs Y in the background.
  3. UI is not aware if Y succeeds or not.

The challenge I am facing is returning a response back for X and at the same time triggering Y in parallel. Any safe thread pattern that can be followed here?

Jim
  • 355
  • 7
  • 20
  • 2
    Does this answer your question? [Simplest way to do a fire and forget method in c# 4.0](https://stackoverflow.com/questions/5613951/simplest-way-to-do-a-fire-and-forget-method-in-c-sharp-4-0) – Liam Jan 21 '21 at 14:32
  • Tl;Dr `Task.Run(() => {})` – Liam Jan 21 '21 at 14:33

0 Answers0