Monday, March 5, 2012

Remove one list from other list without loop


var integers = new List<int> { 1, 2, 3, 4, 5 };
            var remove = new List<int> { 1, 3, 5 };
            integers.RemoveAll(i => remove.Contains(i));
            List<string> lis1 = new List<string>() { "1", "2", "3", "4", "5" };
            List<string> lis2 = new List<string>() { "1", "3", "5", "0" };

Thanks
Mahesh K. Sharma

No comments: