This document is archived and information here might be outdated.  Recommended version.

ISet.Add Method (ArcObjects .NET 10.7 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > System > ESRI.ArcGIS.esriSystem > Interfaces > IS > ISet Interface > ISet.Add Method
ArcGIS Developer Help

ISet.Add Method

Adds an object to the set.

[Visual Basic .NET]
Public Sub Add ( _
    ByVal unk As Object _
public void Add (
    object unk
unk [in]

unk is a parameter of type IUnknown

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


Adds the specified object to the Set. If you add the same object to a Set twice, no error occurs but the resulting Set has only one reference to the object.


The order in which objects are added to the Set using Add is not guaranteed to be the same order in which they are returned by the Next method.

When adding an object to a Set, you are merely adding a new reference to the object not copying it. The reference is released when the Set is destroyed or the object is removed. For example, if you add geodatabase features to a Set (or an Array) using a feature cursor, you must use a non-recycling cursor, otherwise the memory location of the previous feature is overwritten.

See Also

ISet Interface