Skip to content

Instantly share code, notes, and snippets.

@kevingosse
Last active September 22, 2022 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevingosse/39bedb8d691b2eb4bea1925388efd824 to your computer and use it in GitHub Desktop.
Save kevingosse/39bedb8d691b2eb4bea1925388efd824 to your computer and use it in GitHub Desktop.
var taskCompletionSource = new TaskCompletionSource();
MyDelegateType myDelegate = () => taskCompletionSource.SetResult();
NativeMethods.MyNativeMethod(myDelegate);
await taskCompletionSource.Task;
GC.KeepAlive(myDelegate);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment