Class

# Set

<div class="rst-class">

forsearch

</div>

Set

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

A collection that stores unique values with no duplicates. Set uses case-sensitive comparison for strings, meaning 'Apple', 'apple', and 'APPLE' are treated as distinct values. Values can be of any type that can be stored in a Variant. Sets are unordered collections optimized for fast membership testing and set operations like union, intersection, and difference. Use Set when you need to ensure uniqueness of elements or perform mathematical set operations on collections.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name               | Type                               | Read-Only | Shared |
|--------------------|------------------------------------|-----------|--------|
| `Count<set.count>` | `Integer</api/data_types/integer>` | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                       | Parameters                                                                                                                           | Returns                                | Shared |
|--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|--------|
| `Add<set.add>`                             | item As `Variant</api/data_types/variant>`, `ParamArray</api/language/paramarray>` moreItems() As `Variant</api/data_types/variant>` |                                        |        |
| `Complement<set.complement>`               | otherSet As Set                                                                                                                      | Set                                    |        |
| `Constructor<set.constructor>`             | otherSet As Set                                                                                                                      |                                        |        |
| `Differences<set.differences>`             | otherSet As Set                                                                                                                      | Set                                    |        |
| `FromArray<set.fromarray>`                 | doubleArray() As `Double</api/data_types/double>`                                                                                    | Set                                    | ✓      |
|                                            | int32Array() As `Int32</api/data_types/additional_types/int32>`                                                                      | Set                                    | ✓      |
|                                            | int64Array() As `Int64</api/data_types/additional_types/int64>`                                                                      | Set                                    | ✓      |
|                                            | objectArray() As `Object</api/data_types/additional_types/object>`                                                                   | Set                                    | ✓      |
|                                            | singleArray() As `Single</api/data_types/single>`                                                                                    | Set                                    | ✓      |
|                                            | stringArray() As `String</api/data_types/string>`                                                                                    | Set                                    | ✓      |
|                                            | variantArray() As `Variant</api/data_types/variant>`                                                                                 | Set                                    | ✓      |
| `FromDictionary<set.fromdictionary>`       | dict As `Dictionary</api/language/dictionary>`                                                                                       | Set                                    | ✓      |
| `HasMember<set.hasmember>`                 | item As `Variant</api/data_types/variant>`                                                                                           | `Boolean</api/data_types/boolean>`     |        |
| `Intersection<set.intersection>`           | otherSet As Set                                                                                                                      | Set                                    |        |
| `Intersects<set.intersects>`               | otherSet As Set                                                                                                                      | `Boolean</api/data_types/boolean>`     |        |
| `IsSubsetOf<set.issubsetof>`               | otherSet As Set                                                                                                                      | `Boolean</api/data_types/boolean>`     |        |
| `Iterator<set.iterator>`                   |                                                                                                                                      | `Iterator</api/language/iterator>`     |        |
| `Operator_Add<set.operator_add>`           | otherSet As Set                                                                                                                      | Set                                    |        |
| `Operator_Subtract<set.operator_subtract>` | otherSet As Set                                                                                                                      | Set                                    |        |
| `Pop<set.pop>`                             |                                                                                                                                      | `Variant</api/data_types/variant>`     |        |
| `Remove<set.remove>`                       | item As `Variant</api/data_types/variant>`                                                                                           |                                        |        |
| `RemoveAll<set.removeall>`                 |                                                                                                                                      |                                        |        |
| `ToArray<set.toarray>`                     |                                                                                                                                      | `Variant()</api/data_types/variant>`   |        |
| `ToDictionary<set.todictionary>`           |                                                                                                                                      | `Dictionary</api/language/dictionary>` |        |
| `Union<set.union>`                         | otherSet As Set                                                                                                                      | Set                                    |        |

## Property descriptions

<div id="set.count">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Count

**Count** As `Integer</api/data_types/integer>`

> The number of values in the <span class="title-ref">Set</span>.
>
> This property is read-only.

## Method descriptions

<div id="set.add">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Add

**Add**(item As `Variant</api/data_types/variant>`, `ParamArray</api/language/paramarray>` moreItems() As `Variant</api/data_types/variant>`)

> Adds the *item(s)* to the <span class="title-ref">Set</span>.

<div id="set.complement">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Complement

**Complement**(otherSet As Set) As Set

> Returns a <span class="title-ref">Set</span> whose members appear in the <span class="title-ref">Set</span> but are not in the *otherSet*.

<div id="set.constructor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Constructor

**Constructor**(otherSet As Set)

> Creates a <span class="title-ref">Set</span> made of members that are identical to the *otherSet* passed.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> `Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/New>` keyword and pass in the parameters above.
>
> </div>

<div id="set.differences">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Differences

**Differences**(otherSet As Set) As Set

> Returns a new <span class="title-ref">Set</span> with members that appear in <span class="title-ref">Set</span> or *otherSet*, but not both.

<div id="set.fromarray">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.FromArray

**FromArray**(doubleArray() As `Double</api/data_types/double>`) As Set

> Return a new <span class="title-ref">Set</span> with the elements from the array.
>
> This method is `shared</api/language/shared>`.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**FromArray**(int32Array() As `Int32</api/data_types/additional_types/int32>`) As Set

> Return a new <span class="title-ref">Set</span> with the elements from the array.
>
> This method is `shared</api/language/shared>`.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**FromArray**(int64Array() As `Int64</api/data_types/additional_types/int64>`) As Set

> Return a new <span class="title-ref">Set</span> with the elements from the array.
>
> This method is `shared</api/language/shared>`.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**FromArray**(objectArray() As `Object</api/data_types/additional_types/object>`) As Set

> Return a new <span class="title-ref">Set</span> with the elements from the array.
>
> This method is `shared</api/language/shared>`.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**FromArray**(singleArray() As `Single</api/data_types/single>`) As Set

> Return a new <span class="title-ref">Set</span> with the elements from the array.
>
> This method is `shared</api/language/shared>`.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**FromArray**(stringArray() As `String</api/data_types/string>`) As Set

> Return a new <span class="title-ref">Set</span> with the elements from the array.
>
> This method is `shared</api/language/shared>`.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**FromArray**(variantArray() As `Variant</api/data_types/variant>`) As Set

> Return a new <span class="title-ref">Set</span> with the elements from the array.
>
> This method is `shared</api/language/shared>`.

<div id="set.fromdictionary">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.FromDictionary

**FromDictionary**(dict As `Dictionary</api/language/dictionary>`) As Set

> Return a new <span class="title-ref">Set</span> populated with the keys of the `Dictionary</api/language/dictionary>` passed.
>
> This method is `shared</api/language/shared>`.

<div id="set.hasmember">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.HasMember

**HasMember**(item As `Variant</api/data_types/variant>`) As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if the <span class="title-ref">Set</span> has a member that matches the *item* passed.

<div id="set.intersection">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Intersection

**Intersection**(otherSet As Set) As Set

> Returns a new <span class="title-ref">Set</span> with members that are common to the <span class="title-ref">Set</span> and the *otherSet*.

<div id="set.intersects">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Intersects

**Intersects**(otherSet As Set) As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if the <span class="title-ref">Set</span> and the *otherSet* have member values in common.

<div id="set.issubsetof">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.IsSubsetOf

**IsSubsetOf**(otherSet As Set) As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if every member of the <span class="title-ref">Set</span> is present in *otherSet*.

<div id="set.iterator">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Iterator

**Iterator** As `Iterator</api/language/iterator>`

> Allows iterating through the <span class="title-ref">Set</span> with `For...Each</api/language/loops/for_each...next>`

<div id="set.operator_add">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Operator_Add

**Operator_Add**(otherSet As Set) As Set

> Returns a new <span class="title-ref">Set</span> whose members are the union of both the <span class="title-ref">Set</span> and the *otherSet*.

<div id="set.operator_subtract">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Operator_Subtract

**Operator_Subtract**(otherSet As Set) As Set

> Returns a copy of the <span class="title-ref">Set</span> minus any values that are also in the *otherSet*.

<div id="set.pop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Pop

**Pop** As `Variant</api/data_types/variant>`

> Removes and returns an arbitrary member of the <span class="title-ref">Set</span>.
>
> If the <span class="title-ref">Set</span> is empty, a `RuntimeException</api/exceptions/runtimeexception>` occurs.

<div id="set.remove">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Remove

**Remove**(item As `Variant</api/data_types/variant>`)

> Removes the *item* passed.
>
> If the *item* is not found, a `KeyNotFoundException</api/exceptions/keynotfoundexception>` occurs.

<div id="set.removeall">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.RemoveAll

**RemoveAll**

> Removes all members from the <span class="title-ref">Set</span>.

<div id="set.toarray">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.ToArray

**ToArray** As `Variant()</api/data_types/variant>`

> Returns a `Variant</api/data_types/variant>` array of the items in the <span class="title-ref">Set</span>.

<div id="set.todictionary">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.ToDictionary

**ToDictionary** As `Dictionary</api/language/dictionary>`

> Returns a `Dictionary</api/language/dictionary>` with the members as keys.

<div id="set.union">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Set.Union

**Union**(otherSet As Set) As Set

> Returns a new <span class="title-ref">Set</span> that contain the members of the <span class="title-ref">Set</span> and the *otherSet*.

## Interfaces

This class implements the `Iterable</api/language/iterable>` class interface.

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class

</div>
