Use delegate for send process into background

Use delegate for send process into background




This is simple and very use full code for the user who's application or code is too
complex and take a very long time to execution.

By this we can send our process into background and our page will be relax for the another work.


using System.Threading;
public delegate void WaitCallBack();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (ThreadPool.QueueUserWorkItem(new WaitCallback(ImportFile)))
this.ImportFile1();
}
}

public void ImportFile1()
{
// Your Code;
}


In above code write your logic into ImportFile1. I had developed this code for file import into database. This file is too large and take a lot time for execution.But using delegate option it is going into background process.


Regard,
umesh soni,
Ahmedabad


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: