gpt4 book ai didi

c# - 我应该使用 MethodInvoker 还是 Action

转载 作者:行者123 更新时间:2023-11-30 16:32:17 26 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
MethodInvoker vs Action for Control.BeginInvoke

    ThreadPool.QueueUserWorkItem(x =>
{
//get dataset from web service

BeginInvoke(new Action(() => {
//fill grid
}));

BeginInvoke(new MethodInvoker(() => {
//fill grid
}));
});

在 C# 2.0 中,我使用分配 MethodInvoker 从后台线程更新 UI,在 BeginInvoke 下使用时切换到 Action 是否明智?使用 Action 是更快还是更安全?

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