首页 > 解决方案 > Should i avoid using invoke?

问题描述

Many times inside my code i am using an async task. When i want to change something inside ui thread then i am using code as described it below. I have already tried and tested this code.

if (this.InvokeRequired)
{
    this.Invoke(new MethodInvoker(delegate
    {
         //Do sruff      
    }));
}

Is it good practise using invoke? Should i avoid it?

标签: c#winformsinvoke

解决方案


推荐阅读