I have the following item set from an XML:
id category 5 1 5 3 5 4 5 3 5 3
Just use the Distinct() with your own comparer.
Distinct()
http://msdn.microsoft.com/en-us/library/bb338049.aspx