CSharp examples for System.Collections.Generic:IEnumerable
Determines if all items from the second given sequence are present in the first given sequence.
using System.Linq; using System.Collections.Generic; using System;//from w w w.j a v a 2 s .c o m public class Main{ ///<summary>Determines if all items from the second given sequence are present in the first given sequence.</summary> public static bool IsSameOrSubsetOf<T>(this IEnumerable<T> sequence, IEnumerable<T> other) { var r = new HashSet<T>(other); return sequence.All(r.Contains); } }