Remove Items from IList - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:IList

Description

Remove Items from IList

Demo Code


using System.Collections;
using System.Collections.Specialized;
using System.Collections.ObjectModel;
using System.Text;
using System.Collections.Generic;
using System;//ww  w .  jav a 2  s. c o  m

public class Main{
        public static void RemoveItems<T>(IList<T> collection, Equal<T, object> eq, IEnumerable items)
        {
            foreach (var item in items)
            {
                collection.Remove(
                    FindElement(collection, t => eq(t, item)));
            }
        }
}

Related Tutorials