Sometimes we have to start multiple threads,More often, there may be a thread that will manipulate attributes in other threads.

But threads are concurrent,General calls are not able to achieve our requirements.

So we can use delegation here,code show as below

private delegate void delegateinfo ();
private delegate void delegateisend ();
//This is how the thread calls other threads
private void dowork ()
  //determine if invoke is needed, multi-threaded
  if (this.invokerequired)
    //Call the program that writes the main thread control through the delegate,Passing parameters in the object array
    this.invoke (new delegateinfo (loadfile));
    //If delegate calls are not needed,Then call directly
    this.loadfile ();
  //========== End of the thread ============
  this.begininvoke (new delegateisend (isend));
private void isend ()
  wf.close ();
  wf.dispose ();
private void loadfile ()
private waitingform wf=nu
  • Previous Summary of ASPNET Programming to Get the Website Root Directory
  • Next Basic Event Learning Tutorial in MySQL