0
public void loadtemplist(DataTable dt)
    {
      this.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle,

          (Delegate) (() => this.loadtemplist1(dt))   //error


          );
    }

and

public void loadtemplist1(DataTable dt)
    {

-----
-----

}

the above code throws Cannot convert lambda expression to type 'System.Delegate' because it is not a delegate type

2 Answers 2

1

You can't convert an anonymous method straight to a System.Delegate - you need to wrap it in an Action first.

Try this instead:

public void loadtemplist(DataTable dt)
{
  this.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle,

      new Action(() => { this.loadtemplist1(dt); } )
      );
}
Sign up to request clarification or add additional context in comments.

Comments

0

you should do

this.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, 
                            new Action(() => this.loadtemplist1(dt)) );

see demo: https://dotnetfiddle.net/nz9xxD

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.