Search Results

Search found 1 results on 1 pages for 'ibarczewski'.

Page 1/1 | 1 

  • New to threading in C#, can you make thread methods generic and what are the dangers?

    - by ibarczewski
    Hey all, I'm just now starting to get into the idea of threading, and wanted to know if I could make this more abstract. Both foo and bar derive methods from a base class, so I'd like to pass in one or the other and be able to do work using a method that was derived. I'd also like to know how you properly name threads and the methods inside threads. if (ChkFoo.Checked) { Thread fooThread = new Thread(new ThreadStart(this.ThreadedFooMethod)); fooThread.Start(); } if (ChkBar.Checked) { Thread barThread = new Thread(new ThreadStart(this.ThreadedBarMethod)); barThread.Start(); } . . . public void ThreadedFooMethod() { Foo newFoo = new Foo(); //Do work on newFoo } public void ThreadedBarMethod() { Bar newBar = new Bar(); //Do similar work } Thanks all!

    Read the article

1