12345678910111213141516171819202122232425262728293031323334353637 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Ant.ORM
- {
- public class OperatList
- {
- public delegate void ShowHandler();
- public void Show(ShowHandler hander)
- {
- hander();
- }
- public static void ActionWithSearch<T>(List<T> items, Func<T, bool> condition, Action<T> action)
- {
- List<T> results = items.Where(condition).ToList<T>();
- foreach (var item in results)
- {
- action(item);
- }
- }
- public delegate bool SearchStr<T>(T item);
- public static List<T> GetWhereList<T>(List<T> items, SearchStr<T> condition)
- {
- List<T> results = new List<T>();
- foreach (T item in items)
- {
- if (condition(item))
- {
- results.Add(item);
- }
- }
- return results;
- }
- }
- }
|