lstToReturn = new list<item2>(); Parallel.ForEach(lstFromDb, variable=> { Item2 t = new Item2(); //Do some operation lstOfItem2 = Get list from database related to variable t.anotherList = lstOfItem2.Select(c => c.Id); lock(lstToReturn) { lstToReturn.add(t) } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)