CSharp examples for System.Collections.Generic:IEnumerable
Items Equal between two IEnumerable
using System.Linq; using System.Collections.Generic; public class Main{ public static bool ItemsEqual<T>(this IEnumerable<T> collection1, IEnumerable<T> collection2) {/*from w w w . ja v a 2 s . c om*/ if (collection1 == null && collection2 == null) { return true; } if (collection1 == null || collection2 == null) { return false; } if (collection1.Count() != collection2.Count()) { return false; } foreach (var item in collection1) { if (!collection2.Contains(item)) { return false; } } return true; } }