ArcObjects Library Reference (GeoDatabase)  

IRelationshipClass.GetObjectsRelatedToObjectSet Method

Gets the objects that are related to the specified origin or destination object set.

[Visual Basic .NET]
Public Function GetObjectsRelatedToObjectSet ( _
    ByVal anObjectSet As ISet _
) As ISet
[C#]
public ISet GetObjectsRelatedToObjectSet (
    ISet anObjectSet
);
[C++]
HRESULT GetObjectsRelatedToObjectSet(
  ISet* anObjectSet,
  ISet** relatedObjectSet
);
[C++]

Parameters

anObjectSet [in]

  anObjectSet is a parameter of type ISet

relatedObjectSet [out, retval]

  relatedObjectSet is a parameter of type ISet

Product Availability

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

Remarks

The GetObjectsRelatedToObjectSet  method returns a set of objects that are related to the objects contained by the anObjectSet parameter. It behaves the same as GetObjectsRelatedToObject, except that it accepts a set of objects as a parameter.

If multiple objects in the input set are related to a common object, that object will only be included once in the returned set.

If the input set is constructed with a cursor, ensure that a non-recycling cursor is used.

[C#]

    //e.g., nameOfRelClass = "relclass"
    //      nameOfOriginTable = "origintable"
    public void IRelationshipClass__GetObjectsRelatedToObjectSet(IWorkspace workspace, string nameOfRelClass, string nameOfOriginTable)
    {
        IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
        IRelationshipClass relationshipClass = featureWorkspace.OpenRelationshipClass(nameOfRelClass);
        ITable originTable = featureWorkspace.OpenTable(nameOfOriginTable);
        ESRI.ArcGIS.esriSystem.ISet objectSet = new ESRI.ArcGIS.esriSystem.SetClass();
        objectSet.Add(originTable.GetRow(1));
        objectSet.Add(originTable.GetRow(2));
        objectSet.Add(originTable.GetRow(3));
        objectSet.Reset();
        ESRI.ArcGIS.esriSystem.ISet resultSet = relationshipClass.GetObjectsRelatedToObjectSet(objectSet);
        objectSet = null;
    }

See Also

IRelationshipClass Interface