I have a class called step and in it i have a method
public IEnumerable<string> Execute(IEnumerable<string> input)

when i trying creating a thread i did it as below

List<string> l = new List<string>();

step s = new step();
 Thread t3 = new Thread(s.Execute(l));

give me a error msg

"Error 1 The best overloaded method match for 'System.Threading.Thread.Thread(System.Threading.ParameterizedThreadStart)' has some invalid arguments \Program.cs 25 25 PipeFilter


"Error 2 Argument 1: cannot convert from 'System.Collections.Generic.IEnumerable<string>' to 'System.Threading.ParameterizedThreadStart'Program.cs 25 36 PipeFilter

how to i resoleve this

appreciate a reply

Recommended Answers

All 2 Replies

The ParameterizedThreadStart delegate requires a method that returns void, and in your case, the method does not return void. You'll need to rethink your logic.

Think about it, where would the returned value go?

got it

 Thread t3 = new Thread(()=> s.Execute(l));

do you know how do i send data from one thread to another?for example one thread reads part of a file and then sends to another thread to remove non alpahabetic words. this process goes on until all the data from the thread is written,

appreciate a reply,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.