167
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Diagnostics;
5
6
public static class Program
7
{
8
public static int loopcnt = 0;
9
public static IEnumerable<T> RemoveRange<T>(this IEnumerable<T> source, IEnumerable<T> second)
10
{
11
var tempList = source.ToList();
12
13
foreach (var item in second)
14
{
15
tempList.Remove(item); //this is cause a copy like RemoveAt below
16
}
17
18
return tempList;
19
}
20
21
//RemoveAt for arrays, this is problematic copy and shrink time consuming - see my next post on how to fix this!
22
public static void RemoveAt<T>(ref T[] arr, int index)
23
{
24
for (int a = index; a < arr.Length - 1; a++)
Cached Result