Is there a way to get the difference between two sets of objects in c#

I think you want HashSet.Except. That is, rather than use Lists, use HashSets, and then the operation is available. This is a better type if what you are representing is really a ‘set’ anyway. (If you already have a list, you can just create a ‘new HashSet’ out of it.)

Leave a Comment