/// <summary> /// Returns the "Display Field" string value that is shown in ArcMap /// when the feature is selected with a tool (such as the Identify tool). /// </summary> /// <param name="feature">The feature to retrieve the Display Field for.</param> /// <returns>String value of the feature's display field in ArcMap.</returns> public static String GetDisplayFieldValue(IFeature feature) { IFeatureIdentifyObj featureIdentifyObject = new FeatureIdentifyObjectClass(); featureIdentifyObject.Feature = feature; IIdentifyObj identifyObject = featureIdentifyObject as IIdentifyObj; return identifyObject.Name; // exception thrown on this line }
Just a thought but is the feature object you are passing into the function actually a valid object?
featureIdentifyObject.Feature = feature;
= featureIdentifyObject as IIdentifyObj;
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.