Get Origin and destination feature class names from relationship class

396
3
01-19-2012 09:28 AM
Highlighted
New Contributor
Hi,

I was trying to find the Origin featureclass name and the Destination feature class name programatically through vb.net but could not see while implementing Irelationshipclass Interface to get the Feature class name.

We could find the property which specifies the alias name but one cannot reach to the feature class using alias name.

Please suggest how to fetch the information.

Thanks,
Roobesh
0 Kudos
3 Replies
Highlighted
Regular Contributor II
the origin and destination featureclass are returned of type IFeatureclass interface but they are a FeatureClass class.  You need to cast the IFeatureClass to an IDataset which has the name property.
0 Kudos
Highlighted
New Contributor
Thanks!!

How do I cast so that I get the Featureclass name related to my other featureclass though relationship class.

Regards,
0 Kudos
Highlighted
Regular Contributor II
Well assuming you have the relationship class object, the IRelationshipClass.OriginClass property is an IFeatureclass that you cast to IDataset.  The syntax depends on your language of choice.

VB.NET
dim originDataset as IDataset = DirectCast(relClass.OriginClass, IDataset)
dim name as string = originDataset.Name

C#
IDataset originDataset = (IDataset)relClass.OriginClass
string name = originDataset.Name
0 Kudos