Tuesday, 13 August 2013

Comparing two lists of custom objects

Comparing two lists of custom objects

I have two generic lists that I need to compare for any additions or
subtractions of entries. The lists are of a custom class that contains
user connection details.
Dim ConnectedUsersOld As New List(Of ConnectedUser)
Dim ConnectedUsersNew As New List(Of ConnectedUser)
I would like to find:
a) Any ConnectedUsers that are in the ConnectedUsersNew list, that are not
in the ConnectedUsersOld list. (New users for this session)
b) Any ConnectedUsers that are in the ConnectedUsersOld list, that are not
in the ConnectedUsersNew list. (Users that have left since the last
session)
The ConnectedUsers object has a property called username for comparing.

No comments:

Post a Comment