I've got a HashSet,
var universe = new HashSet<int>();
And a bunch of subsets,
var sets = new List<HashSet<int>>(numSets);
I want to subtract a chunk, which I can do like this:
var remaining = universe.ExceptWith(sets[0]);
But ExceptWith
works in-place. I don't want to modify the universe
. Should I clone it first, or is there a better way?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…