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


IRelationshipClass.GetObjectsRelatedToObjectSet Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geodatabase > ESRI.ArcGIS.GeoDatabase > Interfaces > IR > IRelationshipClass Interface > IRelationshipClass.GetObjectsRelatedToObjectSet Method
ArcGIS Developer Help

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
);
[C++]
Parameters
anObjectSet [in]

anObjectSet 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