Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void removedoubles(List<int> exclude, List<int> listcopy)
- {
- for (int j = 0; j < exclude.Count(); j++)
- {
- for (int i = 0; i < listcopy.Count(); i++)
- {
- if (listcopy[i] == exclude[j])
- {
- if (i % 2 == 0) // even
- {
- //listcopy.RemoveRange(i, i + 1);
- listcopy.RemoveAt(i);
- listcopy.RemoveAt(i);
- i = i - 1;
- }
- else //odd
- {
- //listcopy.RemoveRange(i - 1, i);
- listcopy.RemoveAt(i - 1);
- listcopy.RemoveAt(i - 1);
- i = i - 2;
- }
- }
- }
- }
- }
- private List<Tuple<int, int>> getWithoutDoubles(
- HashSet<int> exclude, List<Tuple<int, int>> original)
- {
- return original.Where(xy => (!exclude.Contains(xy.Item1) &&
- !exclude.Contains(xy.Item2)))
- .ToList();
- }
- var a = new List<int> {1, 2, 3, 4, 5};
- var b = new List<int> {1, 2, 3};
- var c = (from i in a let found = b.Any(j => j == i) where !found select i).ToList();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement