I add data to the objects of a List from another List:
public void MergeLsts(List<A> lstA, List<B> lstB)
{
foreach (A dataA in lstA)
{
foreach (B dataB in lstB)
{
if (dataA.ItemNo == dataB.ItemNo)
{
//dataA.ItemDescription is up to this point empty!
dataA.ItemDescription = dataB.ItemDescription;
}
}
}
DoSomethingWithTheNewLst(lstA);
}
This works perfectly fine. However it takes pretty long because both lists get quite large (around 70k items in lstA and 20k items in lstB).
I was wondering if there is a faster or more efficient way to accomplish what I need? Maybe with LINQ?