1

.NET 1.1 lacks ParameterizedThreadStart (I have to use 1.1 because it's the last one supporting NT 4.0)

In .NET 2.0, I would simply write:

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

How can I create equivalent .NET 1.1 code?

Jeff Yates
  • 61,417
  • 20
  • 137
  • 189
skolima
  • 31,963
  • 27
  • 115
  • 151

1 Answers1

5

You would 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();
Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • I missed the `new ThreadStart(` part before, which does work - but only on 2.0 (1.1 missing anonymous delegates). – skolima Dec 04 '08 at 11:44