0

hi,

I have a linq query which fetches a collection of datas. I want to do some functionality with each collection of data. I am

not getting how to pass var object to a thread. My linq to xml query looks like this:

XDocument readStorelist = LoadData();
            var searchResult = from stList in readStorelist.Descendants("Store")
                               select new
                               {
                                   ID = stList.Element("ID").Value,
                                   ListName = stList.Element("ListName").Value,
                                   ListDescription = stList.Element("ListDescription").Value,
                                   CreatedOn = stList.Element("CreatedOn").Value,
                                   CreatedBy = stList.Element("CreatedBy").Value
                               };

I want to do something like this but not sure how to pass strList to the thread:

foreach (var strList in searchResult)
            {

                // Here i want to pass stList to the thread
                Thread th = new Thread(new ThreadStart(DoWork));
                th.Start();
            }

Can someone plz help me on this.

Regards,
Suraj

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by apegram
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.