Dharmendra Singh

Dharmendra Singh

  • NA
  • 119
  • 47.5k

LIst collection item not removes

Apr 27 2013 1:54 AM
Suppose I have two list likes..
List<int> list1={1,2,3,4,5};
List<int> list2={2,3,4};
now i want result in third list like..
List<int> list3={1,5};

I have use


foreach (var t in purchaseResult)
                {
                    for (int counter = 0; counter < poRecive.Count; counter++)
                    {
                        if (t.RecNo == poRecive[counter].RecNo)
                        {
                            poRecive.Remove(t);
                        }
                    }                
                }


but this code not removes data....

Answers (2)