CSharp examples for System.Collections.Generic:IEnumerable
Find All element in IEnumerable
using System.Collections.Generic; using System.Collections; using System;/* ww w .ja v a2 s . com*/ public class Main{ /// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="collection"></param> /// <param name="p"></param> /// <returns></returns> public static List<T> FindAll<T>(IEnumerable<T> collection, Predicate<T> p) { List<T> ret = new List<T>(); foreach (T obj in collection) { if (p(obj)) ret.Add(obj); } return ret; } }