Using C#
I have
Queue N: 3, 4 9, 11
Queue A: 1, 2, 3, 4, 8, 9, 11, 12, 13
I want to remove all elements from Queue A that are present in Queue N
And end up with Queue R: 1, 2, 8, 12, 13
How do I do this in C#
Trying to work with someones API and they offer a way to get the two queues and I need to filter based on one queue returned.
Thanks,
-Seth
Updated Code Example:
I am using a custom data type ModuleDetails
Queue<ModuleDetails> defaultQueue = apiCallDefault();
Queue<ModuleDetails> modQueue = apiCallAllModules();
Easiest to do it with LINQ-to-Objects…
UPDATE: As long as ModuleDetails implements IEquatable, the code below will work just fine. If you can’t modify ModuleDetails, you can always supply an IEqualityComparer as the second argument of Except, which defines how equality is determined.