小编Pet*_*ter的帖子

C#:this.Invoke((MethodInvoker)委托

有人可以解释下面的代码:

                this.Invoke((MethodInvoker)delegate
                {
                    lblNCK.Text = cncType;
                });
Run Code Online (Sandbox Code Playgroud)

这是它来自哪里:

        string cncType;

        if (objDMainCncData != null)
        {
            int rc = objDMainCncData.Init(objDGroupManager.Handle);

            if (rc == 0)
            {
                cncType = objDMainCncData.GetCncIdentifier();

                if (cncType != string.Empty)
                {
                    if (cncType.ToUpper().IndexOf("+") != -1)
                        _bFXplus = true;

                    this.Invoke((MethodInvoker)delegate
                    {
                        lblNCK.Text = cncType;
                    });
                }
            }
            else
            {
                DisplayMessage("objDMainCncData.Init() failed ! error : " + rc.ToString());
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

我没有使用"this.Invoke((MethodInvoker)委托").

提前谢谢你.

彼得.

delegates invoke

4
推荐指数
1
解决办法
7392
查看次数

标签 统计

delegates ×1

invoke ×1