IList扩展

删除操作

data.RemoveAll(x => x.Key == "***");

public static void RemoveAll<T>(this IList<T> src, Predicate<T> match)
{
    int count = src.Count;
    while (count-- > 0)
    {
        if (match(src[count]))
        {
            src.RemoveAt(count);
        }
    }
}
posted @ 2020-04-20 17:04  wesson2019  阅读(83)  评论(0编辑  收藏  举报