sajan vaghela
What is threading in asp.net?
Posted by sajan vaghela in .Net | ASP.NET on Jun 10, 2010
0
Do you know the answer for this question? Post it below.
Guest

C# supports parallel execution of code through multithreading. A thread is an independent execution path, able to run simultaneously with other threads.

A C# client program (Console, WPF, or Windows Forms) starts in a single thread created automatically by the CLR and operating system (the “main” thread), and is made multithreaded by creating additional threads.


using System.Threading


static void PrintHelloFromThreadName() 
        {
            Console.WriteLine("Hello, from thread {0}", 
                Thread.CurrentThread.Name); // {0} 
        } 

        public void ThreadStart() 
        {
            PrintHelloFromThreadName(); 
        } 

        static void Main(string[] args) 
        {
            Thread.CurrentThread.Name = "Main thread"; 
            Class1 obj = new Class1(); 
            Thread thread = new Thread(
                new ThreadStart(obj.ThreadStart)); 
            thread.Name = "Forked thread"; 
            thread.Start(); 
            PrintHelloFromThreadName(); 
        } 

Posted by Arjun Singh Chauhan on Feb 29, 2012
Sponsored by
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Sponsored by
Team Foundation Server Hosting
Become a Sponsor
PRIVACY POLICY | TERMS & CONDITIONS | SITEMAP | CONTACT US | REPORT ABUSE © 2011 C# Corner. All contents are copyright of their authors.