예제 #1
0
        public static ICollection Subtract(ICollection a, ICollection b)
        {
            GenericValidator.NotNull(a, "The parameter a is null");
            GenericValidator.NotNull(b, "The parameter b is null");

            var result = new ArrayList(a);

            foreach (var item in b)
            {
                result.Remove(item);
            }

            return(result);
        }
예제 #2
0
        public static T[] Subtract <T>(T[] a, T[] b)
        {
            GenericValidator.NotNull(a, "The parameter a is null");
            GenericValidator.NotNull(b, "The parameter b is null");

            var result = new List <T>();

            foreach (var item in b)
            {
                result.Remove(item);
            }

            return(result.ToArray());
        }