Asp.net multithreading with parameter operations

Source: Internet
Author: User

Email sending is used in the project. Because the sending process is very slow, the returned data is somewhat delayed, so the thread is taken into account,

CodeAs follows:

This is a thread with Parameters

// Send an email
Thread th = new thread (New parameterizedthreadstart (New maticsoft. BLL. job_company_basicinfo (). post_email ));
Th. Start (modelapp. comid );

The post_email parameter must be of the object type.

 

Another method

VaR OBJ = new mythread ("info ");
VaR T3 = new thread (obj. threadmain) callback
T3.start ();

Public class mythread

{

Private string data;

Public mythread (string data)

{

This. Data = data;

}

Public void threadmain ()

{
Console.. writeline ("running in a thread, data: (0)", data );

}

}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.