CSharp examples for System.Collections.Generic:IEnumerable
Check if IEnumerable Contains by condition
using System.Reflection; using System.Linq; using System.Collections.Generic; using System;/*from w w w .j av a 2s . c om*/ public class Main{ public static bool Contains<T>(this IEnumerable<T> list, Func<T, bool> predicate) { foreach (var item in list) { if (predicate(item)) { return true; } } return false; } }