0

Hi.
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>();
                        l.Add("a");
                        l.Add("r");
                        l.Add("d");

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

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
"

and

"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
thanks

2
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by anisha.silva
0

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?

Edited by Momerath

0

got it

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

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,
thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.