public static Task <int> CalculateUVsAsync(this DMesh3 dMesh) { TaskCompletionSource <int> tcs1 = new TaskCompletionSource <int>(); Task <int> t1 = tcs1.Task; t1.ConfigureAwait(false); // Start a background task that will complete tcs1.Task Task.Factory.StartNew(() => { dMesh.CalculateUVs(); tcs1.SetResult(1); }); return(t1); }