找了一下C#的List接口 没有找到相关的接口
就自己重造了个轮子
public delegate bool SelectCondition<T>(T t);
public static List<T> SiftingList<T> (this List<T> list, SelectCondition<T> condition)
{
if (null == list)
{
Assert.IsTrue(false);
return null;
}
if (null == condition)
{
Assert.IsTrue(false);
return null;
}
List<T> retList = new List<T>();
for (int i = 0; i < list.Count; i++)
{
T t = list[i];
if (retList.Contains(t))
{
continue;
}
if (condition(t))
{
retList.Add(t);
}
}
return retList;
}