c# - Check two List<int>'s for the same numbers -


I have two listings, which I want to check related numbers.

For example

  from the list & lt; Integer & gt; A = new list & lt; Int & gt; () {1, 2, 3, 4, 5}; & Lt; Integer & gt; B = new list & lt; Int & gt; () {0, 4, 8, 12};  

Should give results 4. Is there an easy way to do this without looping through lists?

I'm on the 3.0 for the project where I need it so no Linq.

you 3.5. You can use. Cutting () Expansion Method: -

List & lt; Int & gt; A = new list & lt; Int & gt; () {1, 2, 3, 4, 5}; & Lt; Integer & gt; B = new list & lt; Int & gt; () {0, 4, 8, 12}; & Lt; Integer & gt; Common = one. Difference (b). Ollist ();

Comments