gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 00:35:25 25 4
gpt4 key购买 nike

我正在研究新的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com