C # (asp.net) multithreaded usage is described in this article. Share to everyone for your reference, specific as follows:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using System.Web.UI;
Using System.Threading;
Using System.Web.UI.WebControls; Public partial class Muti_thread:System.Web.UI.Page {protected void Page_Load (object sender, EventArgs e) {Thr
EAD Thread1 = new Thread (new ThreadStart (calcsum));
Thread Thread2 = new Thread (new ThreadStart (CALCGAP));
Thread1.start ();
Thread2.start ();
Thread1.join ();
Thread2.join ();
}//Sum method protected void Calcsum () {Long sum = 0;
for (long i = 0; i < i++) {sum = i; Response.Write (String.
Format ("thread1-->i={0}:sum={1}<br/>", I, sum));
Response.Flush ();
System.Threading.Thread.Sleep (5000);
}///difference method protected void Calcgap () {long gap = 0;
for (Long i = i >= 0; i--) {gap = i-1; Response.Write (String.
Format ("thread2-->i={0}:gap={1}<br/>", I, Gap);
Response.Flush (); System.Threading.Thread.Sleep (1000);
}
}
}
Read more about C # Interested readers can view the site topics: "C # Programming Thread Usage Tips summary", "C # Common control usage Tutorial", "WinForm Control Usage Summary", "C # Data structure and algorithm tutorial" and "C # object-oriented Program Design Introductory Course"
I hope this article will help you with C # programming.