ArcGIS Pro 2.7 API Reference Guide
OpenRelationshipClass Method
Example 

ArcGIS.Core.Data Namespace > Geodatabase Class : OpenRelationshipClass Method
The name of the origin table/feature class in the relationship. This value can be obtained by calling RelationshipClassDefinition.GetOriginClass. For feature service geodatabases, this should be a layer ID or the name of the table as it is exposed through the feature service (e.g., "L0States").
The name of the destination table/feature class in the relationship. This value can be obtained by calling RelationshipClassDefinition.GetDestinationClass. For feature service geodatabases, this should be a layer ID or the name of the table as it exposed through the feature service (e.g., "L1Counties").
Gets a IReadOnlyList of specific RelationshipClass or AttributedRelationshipClass instances associated with the originClass and the destinationClass where originClass is the origin table/feature class and destinationClass is the destination table/feature class. This method must be called on the MCT. Use QueuedTask.Run.
Syntax

Parameters

originClass
The name of the origin table/feature class in the relationship. This value can be obtained by calling RelationshipClassDefinition.GetOriginClass. For feature service geodatabases, this should be a layer ID or the name of the table as it is exposed through the feature service (e.g., "L0States").
destinationClass
The name of the destination table/feature class in the relationship. This value can be obtained by calling RelationshipClassDefinition.GetDestinationClass. For feature service geodatabases, this should be a layer ID or the name of the table as it exposed through the feature service (e.g., "L1Counties").

Return Value

Exceptions
ExceptionDescription
No valid geodatabase has been opened prior to calling this operation.
originClass or destinationClass is null or an empty string.
A geodatabase-related exception has occurred.
Remarks
This routine works with regular RelationshipClasss as well as AttributedRelationshipClasss.
Example
// Must be called within QueuedTask.Run().  
// When used with file or enterprise geodatabases, this routine takes two table names.
// When used with feature services, this routine takes layer IDs, or the names of the tables as they are exposed through the service (e.g., "L0States")
public IReadOnlyList<RelationshipClass> OpenRelationshipClassFeatureServices(Geodatabase geodatabase, string originClass, string destinationClass)
{
  return geodatabase.OpenRelationshipClass(originClass, destinationClass);
}
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

Geodatabase Class
Geodatabase Members