开发者

Could SynchronizationContext be used not in WinForms/WPF application?

开发者 https://www.devze.com 2023-01-09 18:38 出处:网络
I\'m writing a component that would be used in WinForms or WPF applications also could be used in W开发者_Go百科indows services or Unit tests. Is there a way to use SynchronizationContext component in

I'm writing a component that would be used in WinForms or WPF applications also could be used in W开发者_Go百科indows services or Unit tests. Is there a way to use SynchronizationContext component in non UI apps?


Any (host) application can make its own SynchronizationContext class and call SynchronizationContext.SetSynchronizationContext.

Alternatively, you could make a no-op SynchronizationContext in your library, then use it whenever SynchronizationContext.Current is null.

The question talks about writing a custom SynchronizationContext.

0

精彩评论

暂无评论...
验证码 换一张
取 消