Software & Finance

Silverlight - Starting a new thread

I have given a simple Silverlight application that can start a new thread.

System.Threading.Thread is the class you want to use to create a thread. When you instantiate System.Threading.Thread the class you can pass two kinds of delegate.

System.Threading.ThreadStart and System.Threading.ParameterizedThreadStart


Here is the sample code:


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Windows;

using System.Windows.Controls;

using System.Threading;



namespace Multi_Threading_Sample



   public partial class MainPage : UserControl


     public void TheadFunction ()


         while (true)


            //Do some work if you access any UI elements, it will crash







      public MainPage()




         Thread myThread = new Thread(ThreadFunction);