© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies

  HomeSource Code DotNet ► C# ▼

Threading

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace file
{
    class Program
    {
        static void Main(string[] args)
        {
            Thread t = new Thread(WriteY);
            t.Start();                          // Run WriteY on the new thread   
            while (true) Console.Write ("x");   // Write 'x' forever
            }
         static void WriteY()
         {  
             while (true) Console.Write ("y");   // Write 'y' forever 
         }
    }
}

 

 

Multithreading

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace filestream
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
        }
        public delegate void new_foo_delegate();

        void new_foo()
        {

            textBox1.Text = "Hullo";

        }

        void foo()
        {
            textBox1.Invoke(new new_foo_delegate(new_foo));
        }

        private void button1_Click(object sender, EventArgs e)
        {
        Thread t=new Thread(new ThreadStart(foo));
            t.Start();
        }
    }
       
    }

 

SLogix Student Projects

⇓Student Projects⇓
⇑Student Projects⇑
bottom