Set.add(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds an element to the set.
public:
bool add(System::Object ^ element);
public bool add (object element);
member this.add : obj -> bool
Public Function add (element As Object) As Boolean
Parameters
- element
- Object
Returns
true if the element is added to the set; otherwise, false.
Remarks
The element added to a set must be of the same type as the type assigned to the set when it was created. An element will not be added if it already exists in the set.
The following example creates a set, adds some integers to it, and then prints out the contents of the set.
{
// Create a set of integers
Set is = new Set (Types::Integer);
int i;
;
// Add values 0 to 9 to the set
for (i = 0; i < 10; i++)
{
is.add(i);
}
print is.toString();
pause;
}