remove All element from one ICollection from another ICollection - CSharp System.Collections

CSharp examples for System.Collections:ICollection

Description

remove All element from one ICollection from another ICollection

Demo Code


using System.Collections;
using System;//from  w ww .j av  a  2s.  co m

public class Main{
    public static bool removeAll(ICollection set, ICollection coll)
      {
         foreach (object item in coll)
         {
            ((IList) set).Remove(item);
         }
         return true;
      }
    public static bool remove(IList collection, object value)
      {
         bool b = collection.Contains(value);
         if (b)
            collection.Remove(value);
         return b;
      }
}

Related Tutorials