
字面意思就是说,有一个线程占着这个对象,你无法再访问了。这个问题的解决办法就是使用:1.BeginInvoke()异步执行,不等待委托结束就更新;
2.Invoke()同步执行,需等待委托执行完。
使用方法如下,两者类似。

button20是对象名,在delegate内可以操作该对象。
字面意思就是说,有一个线程占着这个对象,你无法再访问了。这个问题的解决办法就是使用:1.BeginInvoke()异步执行,不等待委托结束就更新;
2.Invoke()同步执行,需等待委托执行完。
使用方法如下,两者类似。
button20是对象名,在delegate内可以操作该对象。
本文标题:【C#】调用线程无法访问此对象,因为另一个线程拥有该对象
本文链接:https://www.haomeiwen.com/subject/irynektx.html
网友评论