CSharp examples for Collection:List
Excluding items from a list
using System;/*w w w . j a v a 2 s .c o m*/ using System.Collections.Generic; class Program { static void Main(string[] args) { Console.WriteLine("\nExcluding items from a list:"); Queue<int> queue = new Queue<int>(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17 }); HashSet<int> unique = new HashSet<int> { 1, 3, 5, 7, 9, 11, 13, 15 }; unique.ExceptWith(queue); foreach (int n in unique) { Console.WriteLine(n.ToString()); } } }