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


ISet.Add Method (ArcObjects .NET 10.8 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 _
)
[C#]
public void Add (
    object unk
);
[C++]
HRESULT Add(
  LPUNKNOWN unk
);
[C++]
Parameters
unk [in]

unk is a parameter of type IUnknown

Product Availability

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

Description

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.

Remarks

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