Question

.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?

Was it helpful?

Solution

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();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top