I have a IfeatureCursor that I initialized to null. When I try to set it with a IfeatsureSelection.SelectionSet.Search(,,out IfetureCursor) I get an error saying
cannot convert 'out ESRI.ArcGIS.Geodatabase.IFeatureCursor' to 'out ESRI.ArcGIS.Geodatabase.ICursor'
Code
void SelectionChangedFunc() { IFeatureSelection featSel = default(IFeatureSelection); //link to a feature selection IFeatureCursor selCur = null; //feature cursor to iterate IFeature f = default(IFeature); //link to a feature featSel = p_addressLayer as IFeatureSelection; MessageBox.Show("changed"); //debugging purposes if (featSel.SelectionSet.Count > 0) { featSel.SelectionSet.Search(null, false, out selCur); f = selCur.NextRow(); MessageBox.Show(f.Fields.FindField("STR_NAME").ToString()); //debugging purposes MessageBox.Show(selCur.Fields.FindField("STR_NAME").ToString()); //debugging purposes } }
Line 15 is where the issue is. I tried casting with no luck. Anyone come accross this issue or was able to successfully use a IfeatureCursor in C# SDK 10.4
I've just tried using a IFeatureCursor in a search on a selection set using VBA in 10.4 and it worked for...
If your code is not actually accessing the geometry field, which it appears to be the case, why not try ICursor instead?
Hi duncan, I actually figured it out. I had to use ICursor like you suggested, and then cast it as a IFeatureCursor after I call the SelectionSet.Search function.
I am new to this ArcObjects coding. Could someone help me, how to convert ICursor to IFeatureCursor