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
public ISet GetObjectsRelatedToObjectSet (
    ISet anObjectSet
HRESULT GetObjectsRelatedToObjectSet(
  ISet* anObjectSet,
  ISet** relatedObjectSet


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.


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.


    //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();
        ESRI.ArcGIS.esriSystem.ISet resultSet = relationshipClass.GetObjectsRelatedToObjectSet(objectSet);
        objectSet = null;

See Also

IRelationshipClass Interface