I'm pretty novice with LINQ, and I usually use only Where()
function.
Let's suppose that I have two lists with objects of the same type, l1
and l2
.
My actual code looks like this :
int i, j;
for (int i = 0; i < l1.Count; i++)
{
for (int j = 0; j < l2.Count; j++)
{
if (l1[i].Equals(l2[j]))
{
//Do stuff
}
}
}
I have the feeling that I can improve my code with LINQ, by getting all "duplicate" elements in l1
and l2
. Have you any idea of how ?
Thank you in advance and sorry for my bad english.