A question about comparing List<T>

Posted by Varyanica on Stack Overflow See other posts from Stack Overflow or by Varyanica
Published on 2010-03-19T13:30:47Z Indexed on 2010/03/19 13:41 UTC
Read the original article Hit count: 158

Filed under:
|

i have two lists:

List<comparerobj> list_c = new List<comparerobj>();
List<comparerobj> list_b = new List<comparerobj>();

i'm filling lists somehow

then i'm trying to find elements in list_b which list_c doesnt contain:

foreach (comparerobj b in list_b)
        {
            bool lc = !list_c.Contains(b);
            if (lc != true)
            {
                data.Add(b);
            }
        }

but for any b i'm getting that lc = true. what am i doing wrong?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET