c# - Linq List comparing -
Linux is great, but it's always confusing me a bit.
This is my latest confusion:
Say I have two list & lt; String & gt; We can call them
sourceList
and destList
.
I need to find the list of stars in the source list and neither the list of stars in the disistist which are in the list and not in the source list.
This is a bit confusing, so this is the example:
sourceList destlist Orange Apple Apple Grape Grape Kiiwi Banana
So the first result I see is Orange There will be a list with the second result in it will be a list with kiwi and bananas.
Any ideas how to do this with Linq
I really like today It was doing as Suqru has said that this code should do for you:
list & lt; String & gt; First result list = sourcelist.first (destList); & Lt; String & gt; SecondResultList = destList.Except (source list);
The first result will be Orange in it and the second result will be Kiwi and Banana in the list.
Comments
Post a Comment