Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //Instantiate the animal
            mainAnimal = new Animal();

            //Instantiate a thread start instance, providing it the signature of the method that will run in the seperate thread.
            threadDelegate = new ThreadStart(mainAnimal.speak);

            //Instantiate a thread, feeding it the above delegate.
            animalNoiseThread = new Thread(threadDelegate);
        }
Beispiel #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     mainAnimal = new Animal();
     ThreadStart startDelegate = new ThreadStart(mainAnimal.speak);
     thread = new Thread(startDelegate);
 }
Beispiel #3
0
 private void Form1_Load(object sender, EventArgs e)
 {
     mainAnimal = new Animal();
 }
Beispiel #4
0
 private void Form1_Load(object sender, EventArgs e)
 {
     mainAnimal = new Animal();
     speaker = new Thread(mainAnimal.speak);
 }