Retrieving Layer Name from IFeature

Discussion created by chaviland on Apr 25, 2011
Latest reply on Apr 25, 2011 by jamesfreddyc
I want to be able to retrieve the layer name of a IFeature object.  I was previously using the AliasName property of the FeatureClass of the IFeature object, but in some cases of using an enterprise SQL Server DB, this does not represent the full name of the layer like ILayer.Name.  Can I retrieve the ILayer interface from the IFeature object that I have?  I did find that in my one particular test case that comparing the FeatureClass of the IFeature interface and the FeatureClass of the ILayer interface (re-casted as IFeatureLayer) works, but is this a proper method of determining the layer that a feature is on?  The code to retrieve the IFeature inteface that I am using is not available to edit since I would normally be able to retrieve the layer from that.

Thanks in advance