Using Delegates and Predicates
Posted in C# Programming on May 19th, 2010 by phoenixdigital1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | public new TList<T> FindAll(Predicate<T> match) { if (match == null) { throw new ArgumentNullException("match"); } TList<T> result = new TList<T>(); foreach (T item in this.Items) { if (match(item)) { result.Add(item); } } return result; } |
1 | list.FindAll(delegate(TempAddItem t) { return t.ShortCode.Trim() == 'Test'; }); |