PART II
C h a p t e r 2 4 :
C o l l e c t i o n s , E n u m e r a t o r s , a n d I t e r a t o r s
799
setA.Add('B');
setA.Add('C');
setB.Add('C');
setB.Add('D');
setB.Add('E');
Show("Initial content of setA: ", setA);
Show("Initial content of setB: ", setB);
setA.SymmetricExceptWith(setB);
Show("setA after Symmetric difference with SetB: ", setA);
setA.UnionWith(setB);
Show("setA after union with setB: ", setA);
setA.ExceptWith(setB);
Show("setA after subtracting setB: ", setA);
Console.WriteLine();
}
}
The output is shown here:
Initial content of setA: A B C
Initial content of setB: C D E
setA after Symmetric difference with SetB: A B D E
setA after union with setB: A B D E C
setA after subtracting setB: A B
Do'stlaringiz bilan baham: |