Multi tasking

Step 1

 private void ParseRss(NewsCategory categoryItem)
{
// get rss link
}


Step 2

    upadate rss using task.wait all

public void PorcessNews()
{

      var newsCategoryList = _storedb.NewsCategories.ToList();

                Task.WaitAll((from product in newsCategoryList
                              select Task.Run(() => ParseRss(product))).ToArray());

              //  PriceMatchLogger.Debug("NewsParser.Parse: News  parsing complete");

                _storedb.SaveChanges();
}
 

By  Junaid A    26-Nov-2023    2

Solutions


Your Answer

10334