I Have two Queue and i Want To Delete Data is Duplicate and i want to insert only not duplicate in Queue 3
foreach (GPJ_Model _gpjQx in gpjQx) { foreach (GPJ_Model _Model in mainP) { if (_gpjQx.dep.CompareTo(_Model.dep) != 0) { updateP.Enqueue(_Model); } } }
To simplify,
What this is doing is adding to q3 all elements of q1, multiple times, once for every element in q2 that is different from that element of q1. If q1 is
[1, 2, 3]and q2 is also[1, 2, 3]then q3 will have[1, 1, 2, 2, 3, 3].I doubt that is what you want.
Try to describe the problem correctly, possibly using an example. In all likelihood, you will yourself figure out how to solve it then.