My issue is that I have a List of strings, and I want to create one thread for one string, pass the string into the thread. This is my code:
public void getImageSource(List<string> UrlLinks)
foreach (string urlLink in UrlLinks)
{
ThreadStart myThread = delegate { Fetch(urlLink); };
Thread t = new Thread(myThread);
t.Priority = ThreadPriority.Lowest;
t.IsBackground = true;
t.Start();
}
public void Fetch(string Link)
{
MessageBox.Show(Link);
}
But all my messagebox return the same results, the first element in the List. How can I fix it? Thanks in advance.