|
-
Apr 22nd, 2026, 10:26 PM
#1
Thread Starter
Member
Having trouble using Linq to return unique values when comparing two lists
Hello,
I have two lists,
List 1, TeamsList contains 18 unique values (the complete list)
List 2, sortplayinglist can contain anywhere from 2 to 18 unique values (a subset of the complete list)
The values, while unique for each list, are the same. I am simply wanting to get a list of what isn't in list 2 when compared to list one which is the complete list
I am trying to create a third list called notplayingteamslist that only contains the values from the TeamsList that do not appear in the sortplayinglist
Code:
Dim notplayingteamslist = TeamsList.except(sortplayinglist)
If notplayingteamslist.count > Nothing Then
For Each team As String In notplayingteamslist
Debug.Print(team)
Next
End If
After working through the microsoft references for Linq, I boiled it down to the code above,
but unfortunately nothing gets populated into notplayingteamslist.
Any hints are greatly appreciated.
Regards,
Antony
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|