How do I create and run a parameterized stream in .NET 1.1?

.NET 1.1 is missing ParameterizedThreadStart

(I have to use 1.1 because it is the last one to support NT 4.0)

In .NET 2.0, I will simply write:

Thread clientThread = new Thread(new ParameterizedThreadStart(SomeThreadProc));
clientThread.Start(someThreadParams);

      

How do I generate the equivalent .NET 1.1 code?

+1


source to share


1 answer


You will need to create a class for the state:



class Foo {
  private int bar;
  public Foo(int bar) { // and any other args
      this.bar = bar;
  }    
  public void DoStuff() {
     // ...something involving "bar"
  } 
}
...
Foo foo = new Foo(12);
Thread thread = new Thread(new ThreadStart(foo.DoStuff));
thread.Start();

      

+5


source







All Articles