.net - 我在哪里可以找到 ThreadPool.SwitchTo 方法?

标签 .net asynchronous threadpool async-ctp

我正在研究新的 Async CTP 并研究一些示例代码,

我遇到了这段代码:

public async void button1_Click(object sender, EventArgs e) 
{ 
string text = txtInput.Text; 

await ThreadPool.SwitchTo(); // jump to the ThreadPool 

string result = ComputeOutput(text); 
string finalResult = ProcessOutput(result); 

await txtOutput.Dispatcher.SwitchTo(); // jump to the TextBox’s thread 

txtOutput.Text = finalResult; 
}

请问我在哪里可以找到 ThreadPool.SwitchTo? SwithcTo 方法不在 ThreadPool 类上

我有一个 AsyncCtpLibrary.dll 的引用......但运气不好

最佳答案

作为引用,CharlesO 在上面的评论中回答了他的问题:

OK, found it guys, Summary: Provides methods for interacting with the ThreadPool. Remarks: ThreadPoolEx is a placeholder.

Public Shared Function SwitchTo() As System.Runtime.CompilerServices.YieldAwaitable Member of System.Threading.ThreadPoolEx Summary: Creates an awaitable that asynchronously yields to the ThreadPool when awaited.

关于.net - 我在哪里可以找到 ThreadPool.SwitchTo 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4815261/

相关文章:

java - 调用future.cancel()时如何避免困惑?

.net - WinRT 中 COM 的性能如何?

.net - ASP.NET 站点地图配置错误

wpf - 如何覆盖 WPF 中的 TreeViewItem 以允许异步加载子项?

javascript - 使用 await 而不是 Promises 的正确方法是什么?

java - 如何从网络服务器异步下载图片

c# - 为什么我对 Runspace.Open() 的调用没有返回?

c# - 在后期构建中将文件夹添加到 bin(调试/发布)

c# - 局部 View 是否总是需要从顶层 View 传递的模型?

Java 11 HTTP客户端异步执行