format
typescript
HashSet.Swap(rhs)class: HashSet
description
Swaps the elements in the current collection with the elements in the target collection.
parameter
| param_name | type | description |
|---|---|---|
| rhs | HashSet<T> | The target collection. |
reture
| type | description |
|---|---|
void |
code example
typescript
let myHashSet = new HashSet<Number>(Number);
// Add elements to myHashSet
myHashSet.Add(4);
myHashSet.Add(5);
myHashSet.Add(6);
let otherHashSet = new HashSet<Number>(Number);
otherHashSet.Add(1);
otherHashSet.Add(2);
otherHashSet.Add(3);
// Swap the elements in myHashSet with the elements in otherHashSet
myHashSet.Swap(otherHashSet);