I'm a C# newer and trying to develop a C# Library. My API is async and will callback to the user. I want the callback function will execute in the UI thread because I think this is convenient to the user.
public void ApiAsync(EventHandler<MyArgs> completedHandler);
If WPF, I can use Dispatcher.Invoke(), in WindowsForm, maybe another method. But what confused me now is that whether my SDK should do this or just callback in the worker thread and SDK don't care the UI thread and let the user control themselves. Realy appreciate anyone helps me, thanks.