public TaskGetAsyncData() { var taskCompletionSource = new TaskCompletionSource (); // Your async implementation here // Don't forget to call SetResult on the taskCompletionSource when you're done! taskCompletionSource.SetResult("Async data"); return taskCompletionSource.Task; }
public TaskIn this example, we're creating a TaskGetData() { var taskCompletionSource = new TaskCompletionSource (); // Your synchronous implementation here taskCompletionSource.SetResult("Data"); return taskCompletionSource.Task; }