| RankedSetTUnionWith Method |
Add all items in other to this set that are not already in this set.
Namespace:
Kaos.Collections
Assembly:
KaosCollections (in KaosCollections.dll) Version: 4.2.0.0
Syntax Exceptions Remarks Duplicate values in other are ignored.
Examples using System;
using Kaos.Collections;
namespace ExampleApp
{
class RsExample04
{
static string Text<T> (System.Collections.Generic.IEnumerable<T> items)
=> "{ " + String.Join (" ", items) + " }";
static void Main()
{
var set = new RankedSet<int> { 3, 5, 7 };
var arg = new int[] { 5, 7, 9 };
var ew = new RankedSet<int> (set);
var iw = new RankedSet<int> (set);
var se = new RankedSet<int> (set);
var uw = new RankedSet<int> (set);
ew.ExceptWith (arg);
iw.IntersectWith (arg);
se.SymmetricExceptWith (arg);
uw.UnionWith (arg);
Console.WriteLine ($"{Text(set)} ExceptWith {Text(arg)} = {Text(ew)}");
Console.WriteLine ($"{Text(set)} IntersectWith {Text(arg)} = {Text(iw)}");
Console.WriteLine ($"{Text(set)} SymmetricExceptWith {Text(arg)} = {Text(se)}");
Console.WriteLine ($"{Text(set)} UnionWith {Text(arg)} = {Text(uw)}");
}
}
}
See Also